Ejemplo n.º 1
0
 public override void Jump(PawnMovement machine)
 {
     if (machine.jumpCount < maxJumpCount)
     {
         machine.OnAirJump.Invoke();
         machine.SetState(jumpState);
     }
 }
Ejemplo n.º 2
0
        public override void DoFixedUpdate(PawnMovement machine)
        {
            Vector2 v = machine.body.velocity;

            v.y = jumpForce;
            machine.body.velocity = v;
            machine.SetState(airbornState);
        }
Ejemplo n.º 3
0
        public override void Jump(PawnMovement machine, Vector2 destination)
        {
            Sequence seq = DOTween.Sequence();

            seq.Append(machine.transform.DOJump(destination, jumpForce, 1, duration).SetEase(Ease.Linear));
            seq.AppendCallback(() => machine.SetState(moveState));
            seq.SetAutoKill(true);
            seq.Play();
        }
Ejemplo n.º 4
0
        public override void DoFixedUpdate(PawnMovement machine)
        {
            if (!IsGrounded(machine.transform.position, groundedDefinition))
            {
                machine.SetState(airbornState);
                machine.jumpCount = 1;
                return;
            }

            machine.body.velocity = machine.beingHit ? Vector2.zero : Vector2.right * machine.move * speed;
        }
Ejemplo n.º 5
0
        public override void DoFixedUpdate(PawnMovement machine)
        {
            Vector2 v = machine.body.velocity;

            if (PawnMovementGroundedState.IsGrounded(machine.transform.position, groundedDefinition) && v.y <= 0)
            {
                machine.SetState(groundedState);
                return;
            }

            machine.body.gravityScale = v.y < 0 ? gravityScaleFall : gravityScaleClimb;
            v.x = machine.move * speed;
            machine.body.velocity = v;
        }
Ejemplo n.º 6
0
 public override void Jump(PawnMovement machine)
 {
     machine.SetState(jumpState);
 }
Ejemplo n.º 7
0
 public override void Jump(PawnMovement machine, Vector2 destination)
 {
     machine.SetState(jumpState);
     jumpState.Jump(machine, destination);
 }