mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
Expose the catch width from the Catcher
This commit is contained in:
parent
5d0c847835
commit
9314f49bc3
@ -40,10 +40,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
if (!beatmap.HitObjects.Any())
|
if (!beatmap.HitObjects.Any())
|
||||||
return new CatchDifficultyAttributes(mods, 0);
|
return new CatchDifficultyAttributes(mods, 0);
|
||||||
|
|
||||||
float circleSize = beatmap.BeatmapInfo.BaseDifficulty.CircleSize;
|
var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
float catcherWidth = (1.0f - 0.7f * (circleSize - 5) / 5) * 0.62064f * CatcherArea.CATCHER_SIZE;
|
float halfCatchWidth = catcher.CatchWidth * 0.5f;
|
||||||
float catcherWidthHalf = catcherWidth / 2;
|
|
||||||
catcherWidthHalf *= 0.8f;
|
|
||||||
|
|
||||||
var difficultyHitObjects = new List<CatchDifficultyHitObject>();
|
var difficultyHitObjects = new List<CatchDifficultyHitObject>();
|
||||||
|
|
||||||
@ -52,7 +50,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
// We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations.
|
// We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations.
|
||||||
if (hitObject is Fruit)
|
if (hitObject is Fruit)
|
||||||
{
|
{
|
||||||
difficultyHitObjects.Add(new CatchDifficultyHitObject((CatchHitObject)hitObject, catcherWidthHalf));
|
difficultyHitObjects.Add(new CatchDifficultyHitObject((CatchHitObject)hitObject, halfCatchWidth));
|
||||||
}
|
}
|
||||||
if (hitObject is JuiceStream)
|
if (hitObject is JuiceStream)
|
||||||
{
|
{
|
||||||
@ -61,7 +59,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
{
|
{
|
||||||
CatchHitObject objectInJuiceStream = (CatchHitObject)nestedHitObjectsEnumerator.Current;
|
CatchHitObject objectInJuiceStream = (CatchHitObject)nestedHitObjectsEnumerator.Current;
|
||||||
if (!(objectInJuiceStream is TinyDroplet))
|
if (!(objectInJuiceStream is TinyDroplet))
|
||||||
difficultyHitObjects.Add(new CatchDifficultyHitObject(objectInJuiceStream, catcherWidthHalf));
|
difficultyHitObjects.Add(new CatchDifficultyHitObject(objectInJuiceStream, halfCatchWidth));
|
||||||
}
|
}
|
||||||
// Dispose the enumerator after counting all fruits.
|
// Dispose the enumerator after counting all fruits.
|
||||||
nestedHitObjectsEnumerator.Dispose();
|
nestedHitObjectsEnumerator.Dispose();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -105,6 +106,11 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
public class Catcher : Container, IKeyBindingHandler<CatchAction>
|
public class Catcher : Container, IKeyBindingHandler<CatchAction>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Width of the area that can be used to attempt catches during gameplay.
|
||||||
|
/// </summary>
|
||||||
|
internal float CatchWidth => CATCHER_SIZE * Math.Abs(Scale.X);
|
||||||
|
|
||||||
private Container<DrawableHitObject> caughtFruit;
|
private Container<DrawableHitObject> caughtFruit;
|
||||||
|
|
||||||
public Container ExplodingFruitTarget;
|
public Container ExplodingFruitTarget;
|
||||||
@ -232,15 +238,15 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
/// <returns>Whether the catch is possible.</returns>
|
/// <returns>Whether the catch is possible.</returns>
|
||||||
public bool AttemptCatch(CatchHitObject fruit)
|
public bool AttemptCatch(CatchHitObject fruit)
|
||||||
{
|
{
|
||||||
double halfCatcherWidth = CATCHER_SIZE * Math.Abs(Scale.X) * 0.5f;
|
float halfCatchWidth = CatchWidth * 0.5f;
|
||||||
|
|
||||||
// this stuff wil disappear once we move fruit to non-relative coordinate space in the future.
|
// this stuff wil disappear once we move fruit to non-relative coordinate space in the future.
|
||||||
var catchObjectPosition = fruit.X * CatchPlayfield.BASE_WIDTH;
|
var catchObjectPosition = fruit.X * CatchPlayfield.BASE_WIDTH;
|
||||||
var catcherPosition = Position.X * CatchPlayfield.BASE_WIDTH;
|
var catcherPosition = Position.X * CatchPlayfield.BASE_WIDTH;
|
||||||
|
|
||||||
var validCatch =
|
var validCatch =
|
||||||
catchObjectPosition >= catcherPosition - halfCatcherWidth &&
|
catchObjectPosition >= catcherPosition - halfCatchWidth &&
|
||||||
catchObjectPosition <= catcherPosition + halfCatcherWidth;
|
catchObjectPosition <= catcherPosition + halfCatchWidth;
|
||||||
|
|
||||||
if (validCatch && fruit.HyperDash)
|
if (validCatch && fruit.HyperDash)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user