From 51feaa9ddd9992abc56e150efb2aeaf0c46bc9c6 Mon Sep 17 00:00:00 2001 From: fu-majime Date: Sun, 24 Mar 2024 15:07:51 +0900 Subject: [PATCH] Change Block Animation --- Assets/Scripts/Games/BuiltToScaleRvl/Block.cs | 10 ++++++---- .../Games/BuiltToScaleRvl/BuiltToScaleRvl.cs | 14 ++++---------- Assets/Scripts/Games/BuiltToScaleRvl/Rod.cs | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/Games/BuiltToScaleRvl/Block.cs b/Assets/Scripts/Games/BuiltToScaleRvl/Block.cs index 48e9e7397..051b71a86 100644 --- a/Assets/Scripts/Games/BuiltToScaleRvl/Block.cs +++ b/Assets/Scripts/Games/BuiltToScaleRvl/Block.cs @@ -15,7 +15,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl public bool isOpen = false; public bool isPrepare = false; - private double closeBeat; + private double closeBeat = double.MinValue, shootBeat = double.MinValue; private BuiltToScaleRvl game; @@ -47,7 +47,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl blockAnim.Play("miss", 0, 0); } - public void Prepare() + public void Prepare(double beat) { SoundByte.PlayOneShotGame("builtToScaleRvl/playerRetract"); if (PlayerInput.CurrentControlStyle is InputSystem.InputController.ControlStyles.Pad) { @@ -57,6 +57,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl } isOpen = false; isPrepare = true; + shootBeat = beat; } public void Shoot() { @@ -75,6 +76,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl } public void ShootMiss() { + if (!isPrepare) return; if (PlayerInput.CurrentControlStyle is InputSystem.InputController.ControlStyles.Pad) { blockAnim.Play("shoot miss B", 0, 0); } else { @@ -85,13 +87,13 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl public void Open() { + if (isPrepare) return; blockAnim.Play("open", 0, 0); isOpen = true; } public void Idle(double beat = double.MinValue) { - Debug.Log($"Idle:{closeBeat}, {beat}"); - if (closeBeat > beat) return; + if (closeBeat > beat || shootBeat >= beat) return; blockAnim.Play("idle", 0, 0); isOpen = false; } diff --git a/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs b/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs index 13a7e9f9b..3d223368b 100644 --- a/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs +++ b/Assets/Scripts/Games/BuiltToScaleRvl/BuiltToScaleRvl.cs @@ -252,17 +252,11 @@ namespace HeavenStudio.Games if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) { - if (!isPlayerPrepare) - { - PlayBlockOpen(2); - } + PlayBlockOpen(2); } if (PlayerInput.GetIsAction(InputAction_FlickAltPress) && !IsExpectingInputNow(InputAction_FlickAltPress)) { - if (isPlayerPrepare) - { - PlayBlockShootMiss(2); - } + PlayBlockShootMiss(2); } UpdateWidgets(); } @@ -440,10 +434,10 @@ namespace HeavenStudio.Games blocks[position].BounceMiss(); } - public void PlayBlockPrepare(int position) + public void PlayBlockPrepare(int position, double beat = double.MinValue) { if (!IsPositionInRange(position)) return; - blocks[position].Prepare(); + blocks[position].Prepare(beat); } public void PlayBlockShoot(int position) { diff --git a/Assets/Scripts/Games/BuiltToScaleRvl/Rod.cs b/Assets/Scripts/Games/BuiltToScaleRvl/Rod.cs index bf4d580b7..c4ffe71d4 100644 --- a/Assets/Scripts/Games/BuiltToScaleRvl/Rod.cs +++ b/Assets/Scripts/Games/BuiltToScaleRvl/Rod.cs @@ -79,7 +79,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl else if (nextPos == 2) { if (isShoot && time + 1 == endTime) { - actions.Add(new BeatAction.Action(beat, () => game.PlayBlockPrepare(nextPos))); + actions.Add(new BeatAction.Action(beat, () => game.PlayBlockPrepare(nextPos, beat + length))); game.ScheduleInput(beat, length, BuiltToScaleRvl.InputAction_FlickAltPress, ShootOnHit, ShootOnMiss, Empty, CanShootHit); } else {