Example #1
0
 //5)another state
 void Attack()
 {
     //if(t< 0)
     //{
     currentState = Idle;
     //}
 }
Example #2
0
 //3) inside your initializer (Ctor or Awake or Start) save your currentState to the IdleState
 public FSM_Delegates_Simple()
 {
     currentState = Idle;
     //you can see current state as reference type that point a method with the same signature
     //Current State is type StateMachine_State that is the type we declared in point 1),
     //that point to a method with that signature (Signature: Return Type and Parameters)
 }
Example #3
0
        //4) this is a state of your stateMachine becouse have the same signature of the declared type 1)
        void Idle()
        {
            //here go the implementation of this method:


            //now checks:
            //if your condition is verified than switch your state in another state
            //if(distance < 0.5f)
            //{
            currentState = Attack;
            //}
        }