Пример #1
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);
        }
    }
Пример #2
0
 /// <summary>
 /// Sets AI state for Gun.
 /// </summary>
 /// <param name="val">AIAttackState</param>
 public void SetAIState(AIAttackState val)
 {
     currentState = val;
 }
Пример #3
0
 public void ChangeAttackState(AIAttackState newState)
 {
     timer.StartTimer(3);
     startAttackTime    = timer.currentTime[3];
     currentAttackState = newState;
 }