Exemplo n.º 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);
    }
Exemplo n.º 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);
        }
    }
Exemplo n.º 3
0
    public override bool CanTransit(LogicStateType stateType)
    {
        switch (stateType)
        {
        case LogicStateType.Dead:
            return(true);

        default:
            return(false);
        }
    }
Exemplo n.º 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);
        }
    }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
    }
Exemplo n.º 7
0
 public override bool CanTransit(LogicStateType stateType)
 {
     return(true);
 }
Exemplo n.º 8
0
 public abstract bool CanTransit(LogicStateType stateType);