Ejemplo n.º 1
0
    public static State_Player_Move Instantiate()
    {
        if (instance == null)
        {
            instance = new State_Player_Move();
        }

        return(instance);
    }
Ejemplo n.º 2
0
 public override void Execute(PlayerManager obj)
 {
     // If the player die
     if (obj.IsDead())
     {
         obj.GetFSM().ChangeState(State_Player_Die.Instantiate());
     }
     // Loop function during useskill state
     obj.UseSkill();
     // If there is any move input, to move state
     if (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0)
     {
         obj.GetFSM().ChangeState(State_Player_Move.Instantiate());
     }
     // Else to idle state
     else
     {
         obj.GetFSM().ChangeState(State_Player_Idle.Instantiate());
     }
 }
Ejemplo n.º 3
0
 public override void Execute(PlayerManager obj)
 {
     // If the player dies
     if (obj.IsDead())
     {
         obj.GetFSM().ChangeState(State_Player_Die.Instantiate());
     }
     // The loop function during the idle
     obj.Idle();
     // If there is any input, change to the move idle
     if (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0)
     {
         obj.GetFSM().ChangeState(State_Player_Move.Instantiate());
     }
     // If the player is in the worldscene, it cannnot shoot.
     if (!obj.InWorld)
     {
         if (Input.GetButton("Fire1"))
         {
             obj.GetFSM().ChangeState(State_Player_UseSkill.Instantiate());
         }
     }
 }