Example #1
0
    void EnterState(LogicStateType stateType, object value)
    {
        this.currentState = stateType;
        var state = states.ContainsKey(stateType) ? states[stateType] : states[stateType] = CreateLogicState(stateType);

        state.Enter(value);
    }
Example #2
0
    private LogicState_Base CreateLogicState(LogicStateType state)
    {
        switch (state)
        {
        case LogicStateType.Idle:
            return(new LogicState_Idle(this.animator));

        case LogicStateType.Move:
            return(new LogicState_Move(this.animator));

        case LogicStateType.Jump:
            return(new LogicState_Jump(this.animator));

        case LogicStateType.Dance:
            return(new LogicState_Dance(this.animator));

        case LogicStateType.Attack1:
            return(new LogicState_Attack_1(this.animator));

        case LogicStateType.Attack2:
            return(new LogicState_Attack_2(this.animator));

        case LogicStateType.Attack3:
            return(new LogicState_Attack_3(this.animator));

        case LogicStateType.Attack4:
            return(new LogicState_Attack_4(this.animator));

        case LogicStateType.Skill1:
            return(new LogicState_Skill_1(this.animator));

        case LogicStateType.Skill2:
            return(new LogicState_Skill_2(this.animator));

        case LogicStateType.Skill3:
            return(new LogicState_Skill_3(this.animator));

        case LogicStateType.Skill4:
            return(new LogicState_Skill_4(this.animator));

        case LogicStateType.Skill_Special:
            return(new LogicState_Skill_Special(this.animator));

        case LogicStateType.Dead:
            return(new LogicState_Dead(this.animator));

        case LogicStateType.Hurt:
            return(new LogicState_Hurt(this.animator));

        case LogicStateType.HurtDown:
            return(new LogicState_HurtDown(this.animator));

        case LogicStateType.Stun:
            return(new LogicState_Stun(this.animator));

        default:
            return(null);
        }
    }
Example #3
0
    public override bool CanTransit(LogicStateType stateType)
    {
        switch (stateType)
        {
        case LogicStateType.Dead:
            return(true);

        default:
            return(false);
        }
    }
Example #4
0
    private bool IsLoopState(LogicStateType actionState)
    {
        switch (actionState)
        {
        case LogicStateType.Idle:
        case LogicStateType.Move:
        case LogicStateType.Dead:
        case LogicStateType.Stun:
            return(true);

        default:
            return(false);
        }
    }
Example #5
0
 private bool Transitable(LogicStateType from, LogicStateType to)
 {
     if (to == LogicStateType.Idle)
     {
         return(true);
     }
     else if ((int)from > 1000 && (int)to < 1000)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Example #6
0
    public bool DoAction(LogicStateType stateType, object value = null)
    {
        if (Transitable(currentState, stateType))
        {
            if (states.ContainsKey(this.currentState))
            {
                states[currentState].Exit();
            }

            EnterState(stateType, value);
            return(true);
        }
        else
        {
            return(false);
        }
    }
Example #7
0
 public override bool CanTransit(LogicStateType stateType)
 {
     return(true);
 }
Example #8
0
 public abstract bool CanTransit(LogicStateType stateType);