private void Update() { actualState = npcState.Peek(); ExecuteState(); if (canActionWhileBubble) { if (Vector3.Distance(playerReference.transform.position, transform.position) < bubbleActivationDistance) { if (!activated) { activated = true; bubbleText.text = (baseNpcInformation.ReturnFirstDialog().message); bubble.SetActive(true); } } else { if (bubble.activeInHierarchy) { bubble.SetActive(false); activated = false; } } } }
private void Start() { npcState = new Stack <EnumsScript.NPC_State>(); npcState.Push(EnumsScript.NPC_State.IDLE); actualState = npcState.Peek(); rb = GetComponent <Rigidbody>(); playerReference = GameObject.FindGameObjectWithTag("Player"); //gcReference = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>(); }
// Update is called once per frame void Update() { actualState = npcState.Peek(); ExecuteState(); if (Vector3.Distance(playerReference.transform.position, transform.position) < interactDistance) { playerReference.GetComponent <TownCharacterController>().SetShopNpc(this); } }