2017-02-07 12:59:30 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-09-02 17:27:38 +08:00
|
|
|
|
|
2016-10-08 04:35:14 +08:00
|
|
|
|
using System;
|
2016-11-14 17:54:24 +08:00
|
|
|
|
using osu.Game.Modes.Objects;
|
2016-11-14 17:03:20 +08:00
|
|
|
|
using OpenTK;
|
2016-12-11 17:11:22 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-03-06 11:58:14 +08:00
|
|
|
|
using osu.Game.Modes.Osu.Objects.Drawables;
|
2016-09-02 17:27:38 +08:00
|
|
|
|
|
2016-11-14 17:54:24 +08:00
|
|
|
|
namespace osu.Game.Modes.Osu.Objects
|
2016-09-02 17:27:38 +08:00
|
|
|
|
{
|
2016-11-19 18:07:57 +08:00
|
|
|
|
public abstract class OsuHitObject : HitObject
|
2016-09-02 17:27:38 +08:00
|
|
|
|
{
|
2017-03-06 11:58:14 +08:00
|
|
|
|
public const double HITTABLE_RANGE = 300;
|
|
|
|
|
public const double HIT_WINDOW_50 = 150;
|
|
|
|
|
public const double HIT_WINDOW_100 = 80;
|
|
|
|
|
public const double HIT_WINDOW_300 = 30;
|
|
|
|
|
public const double OBJECT_RADIUS = 64;
|
|
|
|
|
|
2016-10-08 04:35:14 +08:00
|
|
|
|
public Vector2 Position { get; set; }
|
|
|
|
|
|
2017-02-09 15:29:21 +08:00
|
|
|
|
public Vector2 StackedPosition => Position + StackOffset;
|
2016-12-11 17:11:22 +08:00
|
|
|
|
|
2016-12-06 20:14:38 +08:00
|
|
|
|
public virtual Vector2 EndPosition => Position;
|
|
|
|
|
|
2017-02-09 15:29:21 +08:00
|
|
|
|
public Vector2 StackedEndPosition => EndPosition + StackOffset;
|
|
|
|
|
|
|
|
|
|
public virtual int StackHeight { get; set; }
|
|
|
|
|
|
2017-02-09 13:56:39 +08:00
|
|
|
|
public Vector2 StackOffset => new Vector2(StackHeight * Scale * -6.4f);
|
|
|
|
|
|
2017-02-09 15:29:21 +08:00
|
|
|
|
public float Scale { get; set; } = 1;
|
|
|
|
|
|
2017-02-20 00:41:51 +08:00
|
|
|
|
public abstract HitObjectType Type { get; }
|
|
|
|
|
|
2017-03-06 11:58:14 +08:00
|
|
|
|
public double HitWindowFor(OsuScoreResult result)
|
|
|
|
|
{
|
|
|
|
|
switch (result)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
return 300;
|
|
|
|
|
case OsuScoreResult.Hit50:
|
|
|
|
|
return 150;
|
|
|
|
|
case OsuScoreResult.Hit100:
|
|
|
|
|
return 80;
|
|
|
|
|
case OsuScoreResult.Hit300:
|
|
|
|
|
return 30;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-11 17:11:22 +08:00
|
|
|
|
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
|
|
|
|
|
{
|
|
|
|
|
base.SetDefaultsFromBeatmap(beatmap);
|
|
|
|
|
|
|
|
|
|
Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5) / 5) / 2;
|
|
|
|
|
}
|
2017-02-14 08:40:26 +08:00
|
|
|
|
}
|
2016-12-11 17:11:22 +08:00
|
|
|
|
|
2017-02-14 08:40:26 +08:00
|
|
|
|
[Flags]
|
|
|
|
|
public enum HitObjectType
|
|
|
|
|
{
|
2017-02-20 00:41:51 +08:00
|
|
|
|
Circle = 1 << 0,
|
|
|
|
|
Slider = 1 << 1,
|
|
|
|
|
NewCombo = 1 << 2,
|
|
|
|
|
Spinner = 1 << 3,
|
2017-02-14 08:40:26 +08:00
|
|
|
|
ColourHax = 122,
|
2017-02-20 00:41:51 +08:00
|
|
|
|
Hold = 1 << 7,
|
|
|
|
|
SliderTick = 1 << 8,
|
2016-09-02 17:27:38 +08:00
|
|
|
|
}
|
|
|
|
|
}
|