Change Block Animation

This commit is contained in:
fu-majime 2024-03-24 15:07:51 +09:00
parent 76b293398e
commit 51feaa9ddd
3 changed files with 11 additions and 15 deletions

View file

@ -15,7 +15,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
public bool isOpen = false; public bool isOpen = false;
public bool isPrepare = false; public bool isPrepare = false;
private double closeBeat; private double closeBeat = double.MinValue, shootBeat = double.MinValue;
private BuiltToScaleRvl game; private BuiltToScaleRvl game;
@ -47,7 +47,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
blockAnim.Play("miss", 0, 0); blockAnim.Play("miss", 0, 0);
} }
public void Prepare() public void Prepare(double beat)
{ {
SoundByte.PlayOneShotGame("builtToScaleRvl/playerRetract"); SoundByte.PlayOneShotGame("builtToScaleRvl/playerRetract");
if (PlayerInput.CurrentControlStyle is InputSystem.InputController.ControlStyles.Pad) { if (PlayerInput.CurrentControlStyle is InputSystem.InputController.ControlStyles.Pad) {
@ -57,6 +57,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
} }
isOpen = false; isOpen = false;
isPrepare = true; isPrepare = true;
shootBeat = beat;
} }
public void Shoot() public void Shoot()
{ {
@ -75,6 +76,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
} }
public void ShootMiss() public void ShootMiss()
{ {
if (!isPrepare) return;
if (PlayerInput.CurrentControlStyle is InputSystem.InputController.ControlStyles.Pad) { if (PlayerInput.CurrentControlStyle is InputSystem.InputController.ControlStyles.Pad) {
blockAnim.Play("shoot miss B", 0, 0); blockAnim.Play("shoot miss B", 0, 0);
} else { } else {
@ -85,13 +87,13 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
public void Open() public void Open()
{ {
if (isPrepare) return;
blockAnim.Play("open", 0, 0); blockAnim.Play("open", 0, 0);
isOpen = true; isOpen = true;
} }
public void Idle(double beat = double.MinValue) public void Idle(double beat = double.MinValue)
{ {
Debug.Log($"Idle:{closeBeat}, {beat}"); if (closeBeat > beat || shootBeat >= beat) return;
if (closeBeat > beat) return;
blockAnim.Play("idle", 0, 0); blockAnim.Play("idle", 0, 0);
isOpen = false; isOpen = false;
} }

View file

@ -252,17 +252,11 @@ namespace HeavenStudio.Games
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
{ {
if (!isPlayerPrepare) PlayBlockOpen(2);
{
PlayBlockOpen(2);
}
} }
if (PlayerInput.GetIsAction(InputAction_FlickAltPress) && !IsExpectingInputNow(InputAction_FlickAltPress)) if (PlayerInput.GetIsAction(InputAction_FlickAltPress) && !IsExpectingInputNow(InputAction_FlickAltPress))
{ {
if (isPlayerPrepare) PlayBlockShootMiss(2);
{
PlayBlockShootMiss(2);
}
} }
UpdateWidgets(); UpdateWidgets();
} }
@ -440,10 +434,10 @@ namespace HeavenStudio.Games
blocks[position].BounceMiss(); blocks[position].BounceMiss();
} }
public void PlayBlockPrepare(int position) public void PlayBlockPrepare(int position, double beat = double.MinValue)
{ {
if (!IsPositionInRange(position)) return; if (!IsPositionInRange(position)) return;
blocks[position].Prepare(); blocks[position].Prepare(beat);
} }
public void PlayBlockShoot(int position) public void PlayBlockShoot(int position)
{ {

View file

@ -79,7 +79,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
else if (nextPos == 2) else if (nextPos == 2)
{ {
if (isShoot && time + 1 == endTime) { 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); game.ScheduleInput(beat, length, BuiltToScaleRvl.InputAction_FlickAltPress, ShootOnHit, ShootOnMiss, Empty, CanShootHit);
} }
else { else {