Scriptum/Assets/NPCType.cs

43 lines
1.1 KiB
C#
Raw Normal View History

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;
2022-10-02 18:45:58 +02:00
if (OnMapAppearanceMethod.Gateway == OnMapAppearanceMethodEnum.NewGame)
{
2022-10-02 18:45:58 +02:00
isQuest = 1; // TODO I guess we decide here if quest is available for player from the very beginning
}
else
{
2022-10-02 18:45:58 +02:00
isQuest = PlayerPrefs.GetInt(name + "-S");
}
2022-10-02 18:45:58 +02:00
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;
2022-10-02 18:45:58 +02:00
PlayerPrefs.SetInt(name + "-S", isQuest);
}
}