public override void Update() { if (CanBeseen()) { nextState = new NpcHide(npc, agent, anim); stage = EVENT.EXIT; } agent.SetDestination(safe.transform.position); if (agent.remainingDistance <= agent.stoppingDistance) { anim.SetTrigger("isIdle"); agent.isStopped = true; if (look) { npc.transform.LookAt(target.transform.position); } if (activated) { FunctionTimer.Create(() => nextState = new NpcScout(npc, agent, anim), 5f); FunctionTimer.Create(() => stage = EVENT.EXIT, 5f); activated = false; } else { base.Update(); } } }
public override void Update() { if (EnemyCount() && !CanBeseen()) { nextState = new NpcScout(npc, agent, anim); stage = EVENT.EXIT; } if (CanBeseen()) { nextState = new NpcHide(npc, agent, anim); stage = EVENT.EXIT; } if (!EnemyCount()) { base.Update(); } /* else // used while debugging code to trigger states * { * agent.SetDestination(GameObject.FindGameObjectWithTag("Player").transform.position); * agent.speed = 5f; * }*/ }
public override void Update() { if (CanBeseen()) { nextState = new NpcHide(npc, agent, anim); stage = EVENT.EXIT; } }
public override void Update() { agent.SetDestination(target.transform.position); distance = Vector3.Distance(npc.transform.position, target.transform.position); if (distance < 5f) { anim.SetTrigger("isWalking"); agent.speed = 3f; } if (distance < 1.25f) { nextState = new NpcKill(npc, agent, anim); stage = EVENT.EXIT; } if (CanBeseen()) { nextState = new NpcHide(npc, agent, anim); stage = EVENT.EXIT; } }