public override void Update() { if (agent.remainingDistance < 1) { if (currentIndex >= GameEnvironment.Singleton.Checkpoints.Count - 1) { currentIndex = 0; } else { currentIndex++; } agent.SetDestination( GameEnvironment.Singleton.Checkpoints[currentIndex] .transform.position); } if (CanSeePlayer()) { nextState = new Pursue(npc, agent, anim, player); stage = EVENT.EXIT; } if (IsPlayerBehind()) { nextState = new Safe(npc, agent, anim, player); stage = EVENT.EXIT; } }
public override void Update() { if (CanSeePlayer()) { nextState = new Pursue(npc, agent, anim, player); stage = EVENT.EXIT; } else if (Random.Range(0, 100) < 10) { nextState = new Patrol(npc, agent, anim, player); stage = EVENT.EXIT; } }