Scriptum/Assets/NPCType.cs
2022-12-06 01:27:02 +01:00

43 lines
1.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NPCType : MonoBehaviour
{
public GameObject lumberjack;
public int isQuest;
public string name;
void Start()
{
NPCDialogue npcdialogue = lumberjack.GetComponent<NPCDialogue>();
name = npcdialogue.name;
if (OnMapAppearanceMethod.IsNewGame())
{
isQuest = 1; // TODO I guess we decide here if quest is available for player from the very beginning
}
else
{
isQuest = PlayerPrefs.GetInt(name + "-S");
}
npcdialogue.isQuest = isQuest;
}
void Update()
{
NPCDialogue npcdialogue = lumberjack.GetComponent<NPCDialogue>();
isQuest = npcdialogue.isQuest;
PlayerPrefs.SetInt(name, isQuest);
}
public void SaveCheckpoint()
{
NPCDialogue npcdialogue = lumberjack.GetComponent<NPCDialogue>();
isQuest = npcdialogue.isQuest;
PlayerPrefs.SetInt(name + "-S", isQuest);
}
}