예제 #1
0
    void CreateState(eAnimationStateName name)
    {
        CharacterState state = null;

        switch (name)
        {
        case eAnimationStateName.Idle:
            state = new Idle_State((int)name);
            break;

        case eAnimationStateName.Run:
            state = new Run_State((int)name);
            break;

        case eAnimationStateName.Attack:
            state = new Attack_State((int)name);
            break;

        case eAnimationStateName.Jump:
            state = new Jump_State((int)name);
            break;

        case eAnimationStateName.Crouch:
            state = new Crouch_State((int)name);
            break;

        case eAnimationStateName.Crouch_Attack:
            state = new CrouchAttack_State((int)name);
            break;

        case eAnimationStateName.Jump_Attack:
            state = new JumpAttack_State((int)name);
            break;

        case eAnimationStateName.Hurt:
            state = new Hurt_State((int)name);
            break;

        case eAnimationStateName.Hide:
            state = new Hide_State((int)name);
            break;

        case eAnimationStateName.Die:
            state = new DIe_State((int)name);
            break;

        case eAnimationStateName.Rise:
            state = new Rise_State((int)name);
            break;

        default:
            break;
        }
        if (state == null)
        {
            return;
        }
        state.Init(_char);
        _aniDic.Add(name, state);
    }
 void Awake()
 {
     instance     = this;
     idleState    = new Idle_State(this);
     chaseState   = new Chase_State(this);
     attackState  = new Attack_State(this);
     hurtState    = new Hurt_State(this);
     dieState     = new Die_State(this);
     specialState = new Special_State(this);
 }