Пример #1
0
        private void Fall(float fallMultiplier)
        {
            CurrentVerticalVelocity -= Player.Gravity * Time.deltaTime * fallMultiplier;

            if (CurrentVerticalVelocity < -Player.MaxFallVelocity)
            {
                CurrentVerticalVelocity = -Player.MaxFallVelocity;
            }

            PhysicsObject.AddMovement(new Vector2(0, CurrentVerticalVelocity * Time.deltaTime));
        }
Пример #2
0
        private void WallSlide()
        {
            float gravityMod = CurrentVerticalVelocity > 0 ? Player.WallClimbMultiplier : Player.WallSlideMultiplier;

            CurrentVerticalVelocity -= Player.Gravity * gravityMod * Time.deltaTime;
            var wallSlideMaxVelocity = -Player.MaxFallVelocity * Player.WallSlideMultiplier;

            if (CurrentVerticalVelocity < wallSlideMaxVelocity)
            {
                CurrentVerticalVelocity = wallSlideMaxVelocity;
            }

            PhysicsObject.AddMovement(new Vector2(0, CurrentVerticalVelocity * Time.deltaTime));
        }
Пример #3
0
 private void Decelerate()
 {
     CurrentVelocity -= Player.DashDecceleration * Time.deltaTime;
     PhysicsObject.AddMovement(Inputs.DashDirection * Player.GetDashDeltaPosition(CurrentVelocity));
 }