internal virtual void Update() { if (Player.Failed) { s_barFill.DrawWidth = 0; } if (!InitialIncrease || InitialIncreaseStartTime > 0) //i think this is more accurate to ouendan. someone said otherwise on the forum but.. { if (newDefault) { if (Player.Mode == PlayModes.Osu) { if (DisplayHp < Ruleset.HP_BAR_MAXIMUM * 0.2) { s_kiIcon.InitialColour = s_barFill.InitialColour = ColourHelper.ColourLerp(Color.Black, Color.Red, Math.Max(0, (float)((Ruleset.HP_BAR_MAXIMUM * 0.2 - DisplayHp) / (Ruleset.HP_BAR_MAXIMUM * 0.2)))); s_kiIcon.Bypass = true; } else if (DisplayHp < Ruleset.HP_BAR_MAXIMUM * 0.5) { s_kiIcon.InitialColour = s_barFill.InitialColour = ColourHelper.ColourLerp(Color.White, Color.Black, Math.Max(0, (float)((Ruleset.HP_BAR_MAXIMUM * 0.5 - DisplayHp) / (Ruleset.HP_BAR_MAXIMUM * 0.5)))); s_kiIcon.Additive = false; s_kiIcon.Bypass = false; } else { s_barFill.InitialColour = Color.White; s_kiIcon.InitialColour = Color.White; s_kiIcon.Additive = true; s_kiIcon.Bypass = false; } } } if (DisplayHp < Ruleset.HP_BAR_MAXIMUM * 0.2) { if (s_kiIcon.localTexture != t_kiDanger2) { s_kiIcon.localTexture = t_kiDanger2; } } else if (DisplayHp < Ruleset.HP_BAR_MAXIMUM * 0.5) { if (s_kiIcon.localTexture != t_kiDanger) { s_kiIcon.localTexture = t_kiDanger; } } else if (s_kiIcon.localTexture != t_kiNormal) { s_kiIcon.localTexture = t_kiNormal; } } //HP Bar if (DisplayHp < CurrentHp) { if (InitialIncrease) { if (InitialIncreaseStartTime < AudioEngine.Time && (Player.Recovering || AudioEngine.AudioState == AudioStates.Playing)) { DisplayHp = Math.Min(Ruleset.HP_BAR_MAXIMUM, DisplayHp + InitialIncreaseRate * (Player.Recovering ? GameBase.ElapsedMilliseconds : AudioEngine.ElapsedMilliseconds)); if (s_kiIcon.Transformations.Count == 0) { s_kiIcon.Transformations.Add(new Transformation(TransformationType.Scale, 1.2F, 0.8F, GameBase.Time, GameBase.Time + 150)); } } } else { DisplayHp = Math.Min(Ruleset.HP_BAR_MAXIMUM, DisplayHp + Math.Abs(CurrentHp - DisplayHp) / 4 * GameBase.FrameRatio); } } else if (DisplayHp > CurrentHp) { InitialIncrease = false; DisplayHp = Math.Max(0, DisplayHp - Math.Abs(DisplayHp - CurrentHp) / 6 * GameBase.FrameRatio); } s_barFill.DrawWidth = (int)Math.Min(s_barFill.Width, Math.Max(0, (s_barFill.Width * (DisplayHp / 200)))); UpdateKiPosition(); }
internal override void Update() { if (AudioEngine.Time < EndTime && IsHit) { Disarm(); } if (IsHit || AudioEngine.Time < StartTime) { return; } double decay = Math.Pow(0.9, InputManager.ElapsedAudioTime / GameBase.SIXTY_FRAME_TIME); rpm = rpm * decay + (1.0 - decay) * (Math.Abs(velocityCurrent) * 1000) / (Math.PI * 2) * 60; if (spriteRpmText != null) { spriteRpmText.Text = string.Format(@"{0:#,0}", rpm); } Player.Instance?.LogSpinSpeed(rpm); if (spriteMiddleTop != null) { spriteMiddleTop.InitialColour = ColourHelper.ColourLerp(Color.White, Color.Red, (float)(AudioEngine.Time - StartTime) / Length); } if (GameBase.Mode == OsuModes.Edit) { editorCircleRotation.EndFloat = (float)(rotationRequirement * Math.PI); floatRotationCount = (float)((AudioEngine.Time - StartTime) / 1000 * hitObjectManager.SpinnerRotationRatio); } else if (AudioEngine.Time < EndTime && AudioEngine.Time > StartTime && !Player.Recovering) { // Mod time is applied here to keep discrepancies between DT, HT and nomod to preserve integrity of older scores. :( double maxAccelThisFrame = HitObjectManager.ApplyModsToTime(maxAccel * InputManager.ElapsedAudioTime, hitObjectManager.ActiveMods); if ((GameBase.Mode == OsuModes.Play && ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.SpunOut)) || Player.Relaxing2) { velocityCurrent = 0.03; } else if (velocityTheoretical > velocityCurrent) { velocityCurrent += Math.Min(velocityTheoretical - velocityCurrent, velocityCurrent < 0 && Player.Relaxing ? maxAccelThisFrame / RELAX_BONUS_ACCEL : maxAccelThisFrame); } else { velocityCurrent += Math.Max(velocityTheoretical - velocityCurrent, velocityCurrent > 0 && Player.Relaxing ? -maxAccelThisFrame / RELAX_BONUS_ACCEL : -maxAccelThisFrame); } velocityCurrent = Math.Max(-0.05, Math.Min(velocityCurrent, 0.05)); float rotationAddition = (float)(velocityCurrent * InputManager.ElapsedAudioTime); float turnRatio = spriteMiddleBottom != null && spriteMiddleBottom.Texture != null ? 0.5f : 1; // We don't want the spinner sprite to spin faster / slower when DT / HT are active. It should always spin proportionally to the cursor spinning rate. SpriteCircleTop.Rotation += (float)HitObjectManager.ApplyModsToTime(rotationAddition * turnRatio, hitObjectManager.ActiveMods); if (spriteMiddleBottom != null) { spriteMiddleBottom.Rotation += (float)HitObjectManager.ApplyModsToTime(rotationAddition, hitObjectManager.ActiveMods); spriteCircleBottom.Rotation = SpriteCircleTop.Rotation / 3f; } if (velocityCurrent != 0) { StartSound(); } else { StopSound(); } floatRotationCount += Math.Abs((float)(rotationAddition / Math.PI)); } updateCompletion(Math.Abs(floatRotationCount) / rotationRequirement * 100); switch (state) { case SpinningState.NotStarted: if (scoringRotationCount == 0 || AudioEngine.Time < StartTime + 500) { break; } spriteSpin?.FadeOut(300); state = SpinningState.Started; break; case SpinningState.Started: if (scoringRotationCount < rotationRequirement) { break; } if (spriteGlow != null) { spriteGlow.InitialColour = new Color(3, 151, 255); } if (spriteSpin != null) { spriteSpin.FadeOut(100); spriteClear.Transformations.Clear(); spriteClear.Transformations.Add(new Transformation(TransformationType.Fade, 0, 1, AudioEngine.Time, Math.Min(EndTime, AudioEngine.Time + 400), EasingTypes.Out)); spriteClear.Transformations.Add(new Transformation(TransformationType.Scale, 2, 0.8f, AudioEngine.Time, Math.Min(EndTime, AudioEngine.Time + 240), EasingTypes.Out)); spriteClear.Transformations.Add(new Transformation(TransformationType.Scale, 0.8f, 1, Math.Min(EndTime, AudioEngine.Time + 240), Math.Min(EndTime, AudioEngine.Time + 400), EasingTypes.None)); spriteClear.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, EndTime - 50, EndTime)); } state = SpinningState.Passed; break; } }