Exemplo n.º 1
0
 public virtual void Init(int id, FieldMonster sc)
 {
     Script = sc;
     stateDic.Add(AIState_Base.Idle, new AIState_Idle(this));
     stateDic.Add(AIState_Base.Attack, new AIState_Attack(this));
     CurrState = stateDic[AIState_Base.Idle];
 }
Exemplo n.º 2
0
 public override bool Switch(int newState)
 {
     Debug.Log(Script.gameObject.name + " switch " + newState);
     if (!active)
     {
         return(false);
     }
     if (State == newState)
     {
         return(false);
     }
     if (!OnExitState())
     {
         return(false);
     }
     State     = newState;
     CurrState = stateDic[newState];
     if (!OnEnterState())
     {
         return(false);
     }
     return(true);
 }