예제 #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));
 }