Scriptum/Assets/NPCType.cs
2022-06-15 19:54:44 +02:00

44 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;
public string name2;
void Start()
{
NPCDialogue npcdialogue = lumberjack.GetComponent<NPCDialogue>();
name = npcdialogue.name;
int continued = PlayerPrefs.GetInt("continued");
if (continued == 1)
{
isQuest = PlayerPrefs.GetInt(name2);
}
else
{
isQuest = PlayerPrefs.GetInt(name);
}
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(name2, isQuest);
}
}