Ejemplo n.º 1
0
    private Coroutine StartAction(EnemyState nextState)
    {
        this.currentState = nextState;

        switch (nextState)
        {
        case EnemyState.Idle:
            currentAction = idle;
            return(CoroutineManager.Instance.StartCoroutineEx(idle.Action()));

        case EnemyState.Attack:
            Debug.LogError("不正な形でAttackが実行されようとしました。");
            currentAction = kiriage;
            return(CoroutineManager.Instance.StartCoroutineEx(kiriage.Action()));

        case EnemyState.Damage:
            currentAction = damage;
            return(CoroutineManager.Instance.StartCoroutineEx(damage.Action()));

        case EnemyState.MoveNear:
            currentAction = chasePlayer;
            return(CoroutineManager.Instance.StartCoroutineEx(chasePlayer.Action()));

        case EnemyState.Death:
            currentAction = death;
            return(CoroutineManager.Instance.StartCoroutineEx(death.Action()));

        default:
            Debug.LogError("不正な行動の呼び出しがありました。 " + nextState);
            return(null);
        }
    }
 private Coroutine StartAttackAction(AttackAction attack)
 {
     currentState  = EnemyState.Attack;
     currentAction = attack;
     return(CoroutineManager.Instance.StartCoroutineEx(attack.Action()));
 }