void CheckDistance() { bool inDistance = false; var dist = Vector3.Distance(Player.position, transform.position); inDistance = (dist < 51f); switch (inDistance) { case true: //look first m_AgressiveState = AgressiveState.LOOK; m_PassiveState = PassiveState.LOOK; //then do direction stuff if (dist < 30) { Vector3 dir = Player.transform.position - transform.position; isVisable = DetectPlayer(dir); } break; case false: m_AgressiveState = AgressiveState.IDLE; m_PassiveState = PassiveState.WANDER; isVisable = false; break; } }
void MoveToPlayer(bool det) { if (det) { m_AgressiveState = AgressiveState.ATTACK; m_PassiveState = PassiveState.INTERACT; } }