mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 17:07:38 +02:00
First PlayerActionEvent Pass (#202)
* update blue bear to use PlayerActionEvent * update built to scale DS to use PlayerActionEvent * update clappy trio to use PlayerActionEvent * update crop stomp to use PlayerActionEvent * update drumming practice to use PlayerActionEvent * update fork lifter to use PlayerActionEvent * update minigame icons * update wizard waltz' icon
This commit is contained in:
@ -130,7 +130,7 @@ namespace HeavenStudio.Games
|
||||
// Cue the marching proper to begin when applicable.
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(startBeat, delegate { StartMarching(startBeat); })
|
||||
new BeatAction.Action(startBeat - 0.25f, delegate { StartMarching(startBeat); })
|
||||
});
|
||||
|
||||
inactiveStart = -1f;
|
||||
@ -208,7 +208,7 @@ namespace HeavenStudio.Games
|
||||
PlayAnims();
|
||||
if (currentMarchBeat % 2 != 0) //step sound
|
||||
{
|
||||
Jukebox.PlayOneShotGame("cropStomp/hmm");
|
||||
MultiSound.Play(new MultiSound.Sound[] {new MultiSound.Sound("cropStomp/hmm", newBeat + marchOffset)});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,8 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
|
||||
private CropStomp game;
|
||||
|
||||
PlayerActionEvent stomp;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
game = CropStomp.instance;
|
||||
@ -21,38 +23,56 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
{
|
||||
if (!game.isMarching)
|
||||
return;
|
||||
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromMargin(nextStompBeat, 1f);
|
||||
Conductor cond = Conductor.instance;
|
||||
|
||||
StateCheck(normalizedBeat);
|
||||
|
||||
if (normalizedBeat > Minigame.LateTime())
|
||||
if (stomp == null)
|
||||
{
|
||||
nextStompBeat += 2f;
|
||||
ResetState();
|
||||
if (GameManager.instance.currentGame == "cropStomp")
|
||||
stomp = game.ScheduleUserInput(nextStompBeat - 1f, 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
||||
}
|
||||
|
||||
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
||||
{
|
||||
game.bodyAnim.Play("Crouch", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void Just(PlayerActionEvent caller, float state)
|
||||
{
|
||||
// REMARK: does not count for performance
|
||||
Stomp(state >= 1f || state <= -1f);
|
||||
}
|
||||
|
||||
private void Miss(PlayerActionEvent caller)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "cropStomp") return;
|
||||
if (!game.isMarching)
|
||||
return;
|
||||
}
|
||||
// REMARK: does not count for performance
|
||||
nextStompBeat += 2f;
|
||||
stomp?.Disable();
|
||||
stomp = game.ScheduleUserInput(nextStompBeat - 1f, 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
||||
}
|
||||
|
||||
if (PlayerInput.Pressed())
|
||||
private void Out(PlayerActionEvent caller) {}
|
||||
|
||||
void Stomp(bool ng)
|
||||
{
|
||||
if (GameManager.instance.currentGame != "cropStomp") return;
|
||||
if (!game.isMarching)
|
||||
return;
|
||||
if (ng)
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
game.Stomp();
|
||||
game.bodyAnim.Play("Stomp", 0, 0);
|
||||
nextStompBeat += 2f;
|
||||
ResetState();
|
||||
}
|
||||
else if (state.notPerfect())
|
||||
{
|
||||
game.bodyAnim.Play("Crouch", 0, 0);
|
||||
nextStompBeat += 2f;
|
||||
ResetState();
|
||||
}
|
||||
else
|
||||
{
|
||||
game.bodyAnim.Play("Crouch", 0, 0);
|
||||
}
|
||||
game.bodyAnim.Play("Crouch", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
game.Stomp();
|
||||
game.bodyAnim.Play("Stomp", 0, 0);
|
||||
}
|
||||
nextStompBeat += 2f;
|
||||
stomp?.Disable();
|
||||
stomp = game.ScheduleUserInput(nextStompBeat - 1f, 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
private float pickTime = 1f;
|
||||
private int veggieState = 0;
|
||||
private bool boinked; // Player got barely when trying to pick.
|
||||
private bool pickEligible = true;
|
||||
|
||||
private float landBeat;
|
||||
|
||||
@ -36,6 +37,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
public void Init()
|
||||
{
|
||||
game = CropStomp.instance;
|
||||
game.ScheduleInput(targetBeat - 1, 1f, InputType.STANDARD_DOWN, StompJust, StompMiss, Out);
|
||||
|
||||
if (!isMole)
|
||||
{
|
||||
@ -68,30 +70,9 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
}
|
||||
|
||||
var cond = Conductor.instance;
|
||||
|
||||
float normalizedBeat = cond.GetPositionFromMargin(targetBeat, 1f);
|
||||
StateCheck(normalizedBeat);
|
||||
|
||||
// In ground.
|
||||
if (veggieState == 0)
|
||||
{
|
||||
if (normalizedBeat > Minigame.LateTime())
|
||||
{
|
||||
veggieState = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
StompVeggie(false);
|
||||
}
|
||||
else if (state.notPerfect())
|
||||
{
|
||||
veggieState = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// In air.
|
||||
else if (veggieState == 1)
|
||||
@ -99,50 +80,82 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
float airPosition = cond.GetPositionFromBeat(stompedBeat, landBeat - stompedBeat);
|
||||
veggieTrans.position = curve.GetPoint(Mathf.Clamp(airPosition, 0, 1));
|
||||
|
||||
if (normalizedBeat > Minigame.EndTime())
|
||||
if (PlayerInput.PressedUp() && !game.IsExpectingInputNow(InputType.STANDARD_UP))
|
||||
{
|
||||
veggieState = -1;
|
||||
|
||||
if (!isMole)
|
||||
Jukebox.PlayOneShotGame("cropStomp/veggieMiss");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (PlayerInput.PressedUp())
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
PickVeggie(false);
|
||||
}
|
||||
else if (state.notPerfect())
|
||||
{
|
||||
veggieState = -1;
|
||||
boinked = true;
|
||||
|
||||
curve.transform.localScale = Vector3.one; // Return curve to normal size in the case of mole curves.
|
||||
|
||||
var key1 = curve.KeyPoints[0];
|
||||
var key1Pos = key1.Position;
|
||||
key1.Position = new Vector3(key1Pos.x, veggieTrans.position.y, key1Pos.z);
|
||||
|
||||
var key2 = curve.KeyPoints[1];
|
||||
var key2Pos = key2.Position;
|
||||
key2.Position = new Vector3(key2Pos.x, veggieTrans.position.y + 2f, key2Pos.z);
|
||||
|
||||
pickedBeat = cond.songPositionInBeats;
|
||||
|
||||
Jukebox.PlayOneShot("miss");
|
||||
|
||||
MissedUpdate();
|
||||
}
|
||||
|
||||
game.bodyAnim.Play("Pick", 0, 0);
|
||||
game.isFlicking = true;
|
||||
pickEligible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StompJust(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (GameManager.instance.autoplay)
|
||||
{
|
||||
StompVeggie(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (state >= 1f)
|
||||
veggieState = -1;
|
||||
else if (state > -1f)
|
||||
StompVeggie(false);
|
||||
}
|
||||
|
||||
private void StompMiss(PlayerActionEvent caller)
|
||||
{
|
||||
veggieState = -1;
|
||||
caller.Disable();
|
||||
}
|
||||
|
||||
private void Out(PlayerActionEvent caller) {}
|
||||
|
||||
private void PickJust(PlayerActionEvent caller, float state)
|
||||
{
|
||||
game.bodyAnim.Play("Pick", 0, 0);
|
||||
game.isFlicking = true;
|
||||
if (!pickEligible) return;
|
||||
if (GameManager.instance.autoplay)
|
||||
{
|
||||
PickVeggie(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (state <= -1f || state >= 1f)
|
||||
{
|
||||
veggieState = -1;
|
||||
boinked = true;
|
||||
|
||||
curve.transform.localScale = Vector3.one; // Return curve to normal size in the case of mole curves.
|
||||
|
||||
var key1 = curve.KeyPoints[0];
|
||||
var key1Pos = key1.Position;
|
||||
key1.Position = new Vector3(key1Pos.x, veggieTrans.position.y, key1Pos.z);
|
||||
|
||||
var key2 = curve.KeyPoints[1];
|
||||
var key2Pos = key2.Position;
|
||||
key2.Position = new Vector3(key2Pos.x, veggieTrans.position.y + 2f, key2Pos.z);
|
||||
|
||||
pickedBeat = Conductor.instance.songPositionInBeats;
|
||||
|
||||
Jukebox.PlayOneShot("miss");
|
||||
|
||||
MissedUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
PickVeggie(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void PickMiss(PlayerActionEvent caller)
|
||||
{
|
||||
veggieState = -1;
|
||||
|
||||
if (!isMole)
|
||||
Jukebox.PlayOneShotGame("cropStomp/veggieMiss");
|
||||
caller.Disable();
|
||||
}
|
||||
|
||||
bool moleLaughing;
|
||||
private void MissedUpdate()
|
||||
{
|
||||
@ -205,11 +218,12 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
var cond = Conductor.instance;
|
||||
|
||||
veggieState = 1;
|
||||
game.ScheduleInput(targetBeat, isMole ? 0.5f : 1f, InputType.STANDARD_UP, PickJust, PickMiss, Out);
|
||||
targetBeat = targetBeat + (isMole ? 0.5f : 1f);
|
||||
|
||||
stompedBeat = cond.songPositionInBeats;
|
||||
|
||||
landBeat = cond.GetBeatFromPositionAndMargin(Minigame.EndTime(), targetBeat, 1f);
|
||||
landBeat = targetBeat + (float)cond.BeatsToSecs(Minigame.EndTime()-1, cond.GetBpmAtBeat(targetBeat));
|
||||
|
||||
if (autoTriggered)
|
||||
{
|
||||
@ -219,10 +233,9 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
|
||||
if (!isMole)
|
||||
{
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(targetBeat - 0.5f, delegate { Jukebox.PlayOneShotGame("cropStomp/veggieOh"); })
|
||||
});
|
||||
MultiSound.Play(
|
||||
new MultiSound.Sound[] { new MultiSound.Sound("cropStomp/veggieOh", targetBeat - 0.5f) }
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -233,8 +246,6 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
veggieTrans.localScale = new Vector3(veggieScale.x * 0.5f, veggieScale.y, veggieScale.z);
|
||||
squashTween = veggieTrans.DOScaleX(veggieScale.x, cond.pitchedSecPerBeat * 0.5f);
|
||||
|
||||
ResetState();
|
||||
|
||||
Update(); // Update flying veggie state immediately.
|
||||
}
|
||||
|
||||
@ -283,13 +294,5 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||
|
||||
PickedUpdate();
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
if (veggieState == 0)
|
||||
StompVeggie(true);
|
||||
else
|
||||
PickVeggie(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user