Beispiel #1
0
 public override void update()
 {
     if (Player.rigidbody2D.velocity.y > -0.2 && Player.rigidbody2D.velocity.y < 0.2)
     {
         StateTransition.OnStateTransition("top");
     }
 }
Beispiel #2
0
 public override void update()
 {
     if (!Input.GetKey("down"))
     {
         StateTransition.OnStateTransition("run");
     }
 }
Beispiel #3
0
 public override void update()
 {
     if (Player.rigidbody2D.velocity.y == 0)
     {
         StateTransition.OnStateTransition("run");
     }
 }
Beispiel #4
0
 public override void update()
 {
     if (Player.rigidbody2D.velocity.y <= -0.2)
     {
         StateTransition.OnStateTransition("fall");
     }
 }
Beispiel #5
0
    protected bool handleInput()
    {
        if (Input.GetKey("up"))
        {
            StateTransition.OnStateTransition("jump");
            return(true);
        }
        else if (Input.GetKey("down"))
        {
            StateTransition.OnStateTransition("slip");
            return(true);
        }

        return(false);
    }
Beispiel #6
0
    public override void update()
    {
        if (handleInput())
        {
            return;
        }

        if (Player.transform.position.x < PlayerBehaviour.getThreshold("pos_x"))
        {
            Player.rigidbody2D.AddForce(Vector3.right * speed);
        }
        else
        {
            StateTransition.OnStateTransition("run");
        }
    }
Beispiel #7
0
    public override void update()
    {
        if (handleInput())
        {
            return;
        }

        if (Player.transform.position.x > PlayerBehaviour.getThreshold("pos_x"))
        {
            StateTransition.OnStateTransition("backward");
        }
        else if (Player.transform.position.x < PlayerBehaviour.getThreshold("pos_x"))
        {
            StateTransition.OnStateTransition("forward");
        }
    }