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

View file

@ -251,19 +251,13 @@ namespace HeavenStudio.Games
if (!cond.isPlaying || cond.isPaused) return;
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
{
if (!isPlayerPrepare)
{
PlayBlockOpen(2);
}
}
if (PlayerInput.GetIsAction(InputAction_FlickAltPress) && !IsExpectingInputNow(InputAction_FlickAltPress))
{
if (isPlayerPrepare)
{
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)
{

View file

@ -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 {