public override void Update(LittleBossAgent agent) { agent.SetPlayerAsDestination(); Debug.Log("Player still in reach"); if (Vector3.Distance(agent.GetDestination(), agent.transform.position) < agent.GetAttackRange()) { Debug.Log("Attack"); agent.SetState(LittleBossAttackState.GetInstance()); } if (agent.GetDistanceBtwPlayerAndReturn() > agent.GetRange()) { Debug.Log("Return"); agent.SetState(LittleBossReturnState.GetInstance()); } }
public override void Update(LittleBossAgent agent) { agent.SetPlayerAsDestination(); if (agent.GetDistanceBtwPlayerAndReturn() > agent.GetRange()) { agent.SetState(LittleBossReturnState.GetInstance()); } else if (Vector3.Distance(agent.transform.position, agent.GetDestination()) > agent.GetAttackRange()) { agent.SetState(LittleBossFollowPlayerState.GetInstance()); } else if (agent.GetCurrentTimeBtwAttacks() < 0) { agent.SetState(GetInstance()); } else { agent.UpdateAttackTime(); } //insert EXPLOSION!! }