Advertisement
Sorcerer-osu

CatchDifficultyHitObject.cs

Mar 6th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.76 KB | None | 0 0
  1. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
  2. // See the LICENCE file in the repository root for full licence text.
  3.  
  4. using System;
  5. using osu.Game.Rulesets.Catch.Objects;
  6. using osu.Game.Rulesets.Catch.UI;
  7. using osu.Game.Rulesets.Difficulty.Preprocessing;
  8. using osu.Game.Rulesets.Objects;
  9.  
  10. namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
  11. {
  12.     public class CatchDifficultyHitObject : DifficultyHitObject
  13.     {
  14.         private const float normalized_hitobject_radius = 41.0f;
  15.  
  16.         public new CatchHitObject BaseObject => (CatchHitObject)base.BaseObject;
  17.  
  18.         public new CatchHitObject LastObject => (CatchHitObject)base.LastObject;
  19.  
  20.         public readonly float NormalizedPosition;
  21.         public readonly float LastNormalizedPosition;
  22.  
  23.         /// <summary>
  24.         /// Milliseconds elapsed since the start time of the previous <see cref="CatchDifficultyHitObject"/>, with a minimum of 40ms.
  25.         /// </summary>
  26.         public readonly double StrainTime;
  27.  
  28.         public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth)
  29.             : base(hitObject, lastObject, clockRate)
  30.         {
  31.             // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
  32.             var scalingFactor = normalized_hitobject_radius / halfCatcherWidth;
  33.  
  34.             NormalizedPosition = BaseObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
  35.             LastNormalizedPosition = LastObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
  36.  
  37.             // Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure
  38.             StrainTime = Math.Max(40, DeltaTime);
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement