private void Start() { idleState = GetComponent <IdleState>(); patrolState = GetComponent <PatrolState>(); chaseState = GetComponent <ChaseState>(); dashAttackState = GetComponent <DashAttackState>(); animator = GetComponent <Animator>(); currentState = idleState; }
public void GoToNextState(IEnemyState nextState) { Vector2 distanceVector = m_owner.transform.position - player.transform.position; float distance = distanceVector.magnitude; if (distance > playerDistanceToTeleport) { nextState = new DashAttackState(); } nextState.OnStateEntered(m_owner); m_owner.GetComponent <BouncerStateMachine> ().currentState = nextState; }