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

            v.y = jumpForce;
            machine.body.velocity = v;
            machine.SetState(airbornState);
        }
Exemple #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();
        }
Exemple #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;
        }
Exemple #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;
        }
Exemple #6
0
 public override void Jump(PawnMovement machine)
 {
     machine.SetState(jumpState);
 }
Exemple #7
0
 public override void Jump(PawnMovement machine, Vector2 destination)
 {
     machine.SetState(jumpState);
     jumpState.Jump(machine, destination);
 }