protected override void OnDeath(Vector3 direction)
    {
        AIDeathState deathState = agent.stateMachine.GetState(AIStateId.Death) as AIDeathState;

        deathState.direction = direction;
        agent.stateMachine.ChangeState(AIStateId.Death);
    }
Exemple #2
0
    /// <summary>
    /// 상태 딕셔너리 추가
    /// **다른 곳에서는 수정이 안됨
    /// **try~catch로는 null값으로 들어가서 catch 잡기가 불가능함
    /// </summary>
    protected override void DictionarySetting()
    {
        base.DictionarySetting();

        patrolState    = GetComponent <AIPatrolState>();
        chaseState     = GetComponent <AIChaseState>();
        attackState    = GetComponent <AIAttackState>();
        knockbackState = GetComponent <AIKnockBackState>();
        deathState     = GetComponent <AIDeathState>();

        dictStateAction.Add(AIController.AIState.IDLE, this);
        dictStateAction.Add(AIController.AIState.PATROL, patrolState);
        dictStateAction.Add(AIController.AIState.CHASE, chaseState);
        dictStateAction.Add(AIController.AIState.ATTACK, attackState);
        dictStateAction.Add(AIController.AIState.KNOCKBACK, knockbackState);
        dictStateAction.Add(AIController.AIState.DEATH, deathState);

        // Debug.Log("접근끝");
        climbState = GetComponent <AIClimbState>();
        if (climbState != null)
        {
            dictStateAction.Add(AIController.AIState.CLIMB, climbState);
        }

        landState = GetComponent <AILandState>();
        if (landState != null)
        {
            dictStateAction.Add(AIController.AIState.LAND, landState);
        }

        jumpState = GetComponent <AIJumpState>();
        if (jumpState != null)
        {
            dictStateAction.Add(AIController.AIState.JUMP, jumpState);
        }

        spitState = GetComponent <AISpitState>();
        if (spitState != null)
        {
            dictStateAction.Add(AIController.AIState.SPIT, spitState);
        }

        leapState = GetComponent <AILeapState>();
        if (leapState != null)
        {
            dictStateAction.Add(AIController.AIState.LEAP, leapState);
        }

        rushState = GetComponent <AIRushState>();
        if (rushState != null)
        {
            dictStateAction.Add(AIController.AIState.RUSH, rushState);
        }
    }