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;
|
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
|
|
|
|
{
|
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; }
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|