diff --git a/SSLR/Assets/Scripts/Despawn.cs b/SSLR/Assets/Scripts/Despawn.cs index d8bd134..7bed0ca 100644 --- a/SSLR/Assets/Scripts/Despawn.cs +++ b/SSLR/Assets/Scripts/Despawn.cs @@ -23,12 +23,10 @@ public class Despawn : MonoBehaviour { if (other.CompareTag("NPC")) { - other.gameObject.SetActive(false); + GameManager.instance.currentNPC = null; + NPCSpawn.instance.npcSpawned = false; + Destroy(other.gameObject); - - npcSpawnScript.npcSpawned = false; } } - - } diff --git a/SSLR/Assets/Scripts/NPCSpawn.cs b/SSLR/Assets/Scripts/NPCSpawn.cs index 99ae71d..07ba14f 100644 --- a/SSLR/Assets/Scripts/NPCSpawn.cs +++ b/SSLR/Assets/Scripts/NPCSpawn.cs @@ -4,14 +4,26 @@ using UnityEngine; public class NPCSpawn : MonoBehaviour { + public static NPCSpawn instance; + [SerializeField] private float npcBufferTime; public bool npcSpawned = false; - /*[SerializeField] - List NPCs = new List();*/ [SerializeField] GameObject npc; + void Awake() + { + if (instance ==null) + { + instance = this; + } + else + { + Destroy(gameObject); + } + } + void Update() { if (!npcSpawned)