using System.Collections; using System.Collections.Generic; using UnityEngine; public class NonPlayerCharacter : MonoBehaviour { public float displayTime = 4.0f; public GameObject dialogBox; float timerDisplay; Vector2 lookDirection = new Vector2(0, -1); void Start() { dialogBox.SetActive(false); timerDisplay = -1.0f; RaycastHit2D hit = Physics2D.Raycast(transform.position, lookDirection, 1.0f, LayerMask.GetMask("Cells")); hit.collider.GetComponent().SetOccupied(true); } void Update() { if (timerDisplay >= 0) { timerDisplay -= Time.deltaTime; if (timerDisplay < 0) { dialogBox.SetActive(false); } } } public void DisplayDialog() { timerDisplay = displayTime; dialogBox.SetActive(true); } }