diff --git a/osu.Game.Rulesets.Rush/Beatmaps/RushBeatmapConverter.cs b/osu.Game.Rulesets.Rush/Beatmaps/RushBeatmapConverter.cs index 02fb185..0ae1d91 100644 --- a/osu.Game.Rulesets.Rush/Beatmaps/RushBeatmapConverter.cs +++ b/osu.Game.Rulesets.Rush/Beatmaps/RushBeatmapConverter.cs @@ -45,11 +45,9 @@ protected override IEnumerable ConvertHitObject(HitObject origina const float ground_position_cutoff = 220f; const double etna_cutoff = 200d; const double repeat_cutoff = 100d; - const double sawblade_cutoff = 0.9f; - const double airsawblade_cutoff = 0.95f; var sampleLane = original.Samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE) ? LanedHitLane.Air : LanedHitLane.Ground; - LanedHitLane? positionLane = null, sawbladeLane = null; + LanedHitLane? positionLane = null; HitObjectType hitObjectType = HitObjectType.Minion; bool bothLanes = false; diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__000.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__000.png new file mode 100755 index 0000000..98e0d6c Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__000.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__001.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__001.png new file mode 100755 index 0000000..a74989d Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__001.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__002.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__002.png new file mode 100755 index 0000000..8490914 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__002.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__003.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__003.png new file mode 100755 index 0000000..e0f66ad Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__003.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__004.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__004.png new file mode 100755 index 0000000..14b2083 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__004.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__005.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__005.png new file mode 100755 index 0000000..6dfabba Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__005.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__006.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__006.png new file mode 100755 index 0000000..7a9a963 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__006.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__007.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__007.png new file mode 100755 index 0000000..e4b41c4 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__007.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__008.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__008.png new file mode 100755 index 0000000..3b94f9a Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__008.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__009.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__009.png new file mode 100755 index 0000000..d1300fa Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Attack__009.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Dead__000.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Dead__000.png new file mode 100755 index 0000000..62d3090 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Dead__000.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__000.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__000.png new file mode 100755 index 0000000..94738d3 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__000.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__001.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__001.png new file mode 100755 index 0000000..63b7000 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__001.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__002.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__002.png new file mode 100755 index 0000000..e52f6dd Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__002.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__003.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__003.png new file mode 100755 index 0000000..5b2a28c Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__003.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__004.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__004.png new file mode 100755 index 0000000..f444aef Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__004.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__005.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__005.png new file mode 100755 index 0000000..777e78f Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__005.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__006.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__006.png new file mode 100755 index 0000000..b797537 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__006.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__007.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__007.png new file mode 100755 index 0000000..a43633c Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__007.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__008.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__008.png new file mode 100755 index 0000000..67829af Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__008.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__009.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__009.png new file mode 100755 index 0000000..bac103a Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump_Attack__009.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__000.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__000.png new file mode 100755 index 0000000..be271f3 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__000.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__001.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__001.png new file mode 100755 index 0000000..95065c3 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__001.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__002.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__002.png new file mode 100755 index 0000000..5650f35 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__002.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__003.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__003.png new file mode 100755 index 0000000..dcc4292 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__003.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__004.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__004.png new file mode 100755 index 0000000..dcc4292 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__004.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__005.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__005.png new file mode 100755 index 0000000..dcc4292 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__005.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__006.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__006.png new file mode 100755 index 0000000..3a41564 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__006.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__007.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__007.png new file mode 100755 index 0000000..633f092 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__007.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__008.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__008.png new file mode 100755 index 0000000..e736ffe Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__008.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__009.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__009.png new file mode 100755 index 0000000..e736ffe Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Jump__009.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__000.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__000.png new file mode 100755 index 0000000..d1760af Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__000.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__001.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__001.png new file mode 100755 index 0000000..1250fb5 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__001.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__002.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__002.png new file mode 100755 index 0000000..2f77b4f Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__002.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__003.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__003.png new file mode 100755 index 0000000..a8bac04 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__003.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__004.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__004.png new file mode 100755 index 0000000..12ac784 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__004.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__005.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__005.png new file mode 100755 index 0000000..bd9c959 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__005.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__006.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__006.png new file mode 100755 index 0000000..6161c8c Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__006.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__007.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__007.png new file mode 100755 index 0000000..4b21eb7 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__007.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__008.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__008.png new file mode 100755 index 0000000..c8ba5b7 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__008.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__009.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__009.png new file mode 100755 index 0000000..99b140b Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Run__009.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__000.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__000.png new file mode 100755 index 0000000..0119ce1 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__000.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__001.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__001.png new file mode 100755 index 0000000..0b1e354 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__001.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__002.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__002.png new file mode 100755 index 0000000..7e5990b Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__002.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__003.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__003.png new file mode 100755 index 0000000..a030cee Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__003.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__004.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__004.png new file mode 100755 index 0000000..2b95660 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__004.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__005.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__005.png new file mode 100755 index 0000000..305e390 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__005.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__006.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__006.png new file mode 100755 index 0000000..c46acb4 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__006.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__007.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__007.png new file mode 100755 index 0000000..2490f99 Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__007.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__008.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__008.png new file mode 100755 index 0000000..3822e9e Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__008.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__009.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__009.png new file mode 100755 index 0000000..cff15be Binary files /dev/null and b/osu.Game.Rulesets.Rush/Resources/Textures/Player/Slide__009.png differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_1.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_1.png deleted file mode 100755 index 7d4a48f..0000000 Binary files a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_1.png and /dev/null differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_2.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_2.png deleted file mode 100755 index c22f059..0000000 Binary files a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_2.png and /dev/null differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_3.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_3.png deleted file mode 100755 index e45baf7..0000000 Binary files a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_3.png and /dev/null differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_4.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_4.png deleted file mode 100755 index effcc5c..0000000 Binary files a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_4.png and /dev/null differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_5.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_5.png deleted file mode 100755 index ca59176..0000000 Binary files a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_5.png and /dev/null differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_6.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_6.png deleted file mode 100755 index 043bdfb..0000000 Binary files a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_6.png and /dev/null differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_7.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_7.png deleted file mode 100755 index cc36519..0000000 Binary files a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_7.png and /dev/null differ diff --git a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_8.png b/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_8.png deleted file mode 100755 index ac28f9c..0000000 Binary files a/osu.Game.Rulesets.Rush/Resources/Textures/Player/run_8.png and /dev/null differ diff --git a/osu.Game.Rulesets.Rush/UI/RushPlayerSprite.cs b/osu.Game.Rulesets.Rush/UI/RushPlayerSprite.cs index 30fec95..035567c 100644 --- a/osu.Game.Rulesets.Rush/UI/RushPlayerSprite.cs +++ b/osu.Game.Rulesets.Rush/UI/RushPlayerSprite.cs @@ -2,20 +2,19 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Textures; using osu.Framework.Utils; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Rush.Objects; using osu.Game.Rulesets.Rush.Objects.Drawables; -using osuTK; namespace osu.Game.Rulesets.Rush.UI { @@ -25,8 +24,11 @@ public class RushPlayerSprite : CompositeDrawable private const float fall_delay = 300f; private const float fall_duration = 150f; private const float travel_duration = 150f; + private const float run_reset_delay = 200f; - private readonly TextureAnimation runningAnimation; + private readonly Dictionary textureAnimations = new Dictionary(); + + private double runResetTime; private PlayerTargetLane target; @@ -35,6 +37,9 @@ public PlayerTargetLane Target get => target; set { + if (value == PlayerTargetLane.MiniBoss) + playAnimation(PlayerAnimation.AirAttack); + if (value == target) return; @@ -47,29 +52,44 @@ public PlayerTargetLane Target break; case PlayerTargetLane.HoldAir: + easeToAir(); + playAnimation(PlayerAnimation.Hold); + break; + case PlayerTargetLane.AttackAir: easeToAir(); + playAnimation(PlayerAnimation.AirAttack); break; case PlayerTargetLane.HoldGround: + easeToGround(); + playAnimation(PlayerAnimation.Hold); + break; + case PlayerTargetLane.AttackGround: easeToGround(); + playAnimation(PlayerAnimation.GroundAttack); break; case PlayerTargetLane.HoldBoth: + easeToCentre(); + playAnimation(PlayerAnimation.Hold); + break; + case PlayerTargetLane.AttackBoth: case PlayerTargetLane.MiniBoss: easeToCentre(); + playAnimation(PlayerAnimation.AirAttack); break; case PlayerTargetLane.GhostAir: easeToGround(); - // TODO: show ghost player + // showGhost(LanedHitLane.Air); break; case PlayerTargetLane.GhostGround: easeToAir(); - // TODO: show ghost player + // showGhost(LanedHitLane.Ground); break; } @@ -85,28 +105,33 @@ public RushPlayerSprite(float groundY, float airY) this.groundY = groundY; this.airY = airY; - InternalChildren = new Drawable[] + AddRangeInternal(Enum.GetValues(typeof(PlayerAnimation)).Cast().Select(createTextureAnimation)); + } + + private TextureAnimation createTextureAnimation(PlayerAnimation animation) => + textureAnimations[animation] = new TextureAnimation { - new Circle - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(100f) - } - // runningAnimation = new TextureAnimation - // { - // Origin = Anchor.Centre, - // Anchor = Anchor.Centre, - // DefaultFrameLength = 50, - // Scale = new Vector2(1) - // }, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + DefaultFrameLength = 1000f / 16f, + Loop = false, + Alpha = 0, }; - } [BackgroundDependencyLoader] private void load(TextureStore store) { - // runningAnimation.AddFrames(Enumerable.Range(1, 8).Select(i => store.Get($"Player/run_{i}"))); + textureAnimations[PlayerAnimation.Run].AddFrames(Enumerable.Range(0, 10).Select(i => store.Get($"Player/Run__{i:D3}"))); + textureAnimations[PlayerAnimation.Jump].AddFrames(Enumerable.Range(0, 10).Select(i => store.Get($"Player/Jump__{i:D3}"))); + textureAnimations[PlayerAnimation.GroundAttack].AddFrames(Enumerable.Range(0, 10).Select(i => store.Get($"Player/Attack__{i:D3}"))); + textureAnimations[PlayerAnimation.AirAttack].AddFrames(Enumerable.Range(0, 10).Select(i => store.Get($"Player/Jump_Attack__{i:D3}"))); + textureAnimations[PlayerAnimation.Hold].AddFrames(Enumerable.Range(0, 10).Select(i => store.Get($"Player/Slide__{i:D3}"))); + textureAnimations[PlayerAnimation.Hurt].AddFrame(store.Get("Player/Dead__000")); + + textureAnimations[PlayerAnimation.Run].Loop = true; + textureAnimations[PlayerAnimation.Hold].Loop = true; + + playAnimation(PlayerAnimation.Run); } public void StopAll() => InternalChildren.OfType().ForEach(a => @@ -115,6 +140,52 @@ public void StopAll() => InternalChildren.OfType().ForEach(a = a.Hide(); }); + // private void playRunning() + // { + // StopAll(); + // textureAnimations[PlayerAnimation.Run].Show(); + // textureAnimations[PlayerAnimation.Run].Restart(); + // } + // + // private void playJumping() + // { + // StopAll(); + // + // runResetTime = Time.Current + run_reset_delay; + // + // textureAnimations[PlayerAnimation.Jump].Show(); + // textureAnimations[PlayerAnimation.Jump].Restart(); + // } + // + // private void playHold() + // { + // StopAll(); + // textureAnimations[PlayerAnimation.Hold].Show(); + // textureAnimations[PlayerAnimation.Hold].Restart(); + // } + // + // private void playAttack(LanedHitLane lane) + // { + // StopAll(); + // + // runResetTime = Time.Current + run_reset_delay; + // + // var animation = lane == LanedHitLane.Air ? PlayerAnimation.AirAttack : PlayerAnimation.GroundAttack; + // textureAnimations[animation].Show(); + // textureAnimations[animation].Restart(); + // } + + private void playAnimation(PlayerAnimation animation, bool delayNextRunAnimation = true) + { + StopAll(); + + if (delayNextRunAnimation && animation != PlayerAnimation.Run) + runResetTime = Time.Current + run_reset_delay; + + textureAnimations[animation].Show(); + textureAnimations[animation].Restart(); + } + /// /// Handles any leftover actions that were not consumed by hitobjects. /// Allows the player to jump over sawblades or punch the ground. @@ -137,15 +208,18 @@ public bool HandleAction(RushAction action) private void jump() { ClearTransforms(); + playAnimation(PlayerAnimation.Jump); this.MoveToY(airY, jump_duration, Easing.Out) - .Then().Delay(fall_delay) - .Then().MoveToY(groundY, fall_duration, Easing.In); + .OnComplete(_ => fall()); } private void fall(bool immediately = false) { using (BeginDelayedSequence(immediately ? 0 : fall_delay)) - this.MoveToY(groundY, fall_duration, Easing.In); + { + this.MoveToY(groundY, fall_duration, Easing.In) + .OnComplete(_ => playAnimation(PlayerAnimation.Run)); + } } private void easeTo(float y) @@ -226,6 +300,14 @@ public bool CollidesWith(HitObject hitObject) return false; } + + protected override void Update() + { + base.Update(); + + if (Target == PlayerTargetLane.None && !textureAnimations[PlayerAnimation.Run].IsPlaying && runResetTime <= Time.Current && Precision.AlmostEquals(Y, groundY)) + playAnimation(PlayerAnimation.Run); + } } [Flags] @@ -247,6 +329,16 @@ public enum PlayerTargetLane MiniBoss = 1 << 4, } + public enum PlayerAnimation + { + Run, + Jump, + GroundAttack, + AirAttack, + Hold, + Hurt + } + public static class PlayerTargetLaneExtensions { public static PlayerTargetLane WithHoldLane(this PlayerTargetLane current, LanedHitLane lane, bool held)