// Use this for initialization void Start() { enemyChaseState = GetComponent <EnemyChaseState>(); enemyWanderState = GetComponent <EnemyWanderState>(); childSprite = transform.Find("Sprite").GetComponent <SpriteRenderer>(); CurrentState = enemyWanderState; CurrentState.OnStateEnter(this); }
void ChangeState(EnemyAIState enemyAIState) { CurrentState.OnStateExit(this); CurrentState = enemyAIState; enemyAIState.OnStateEnter(this); }