minor change

This commit is contained in:
fu-majime 2024-04-17 22:39:03 +09:00
parent 7972e6137d
commit efaf968e52

View file

@ -28,26 +28,26 @@ namespace HeavenStudio.Games.Loaders
new Param("autoBop", false, "Bop (Auto)", "Toggle if the characters should automatically bop until another Bop event is reached.") new Param("autoBop", false, "Bop (Auto)", "Toggle if the characters should automatically bop until another Bop event is reached.")
} }
}, },
new GameAction("mandrill", "Mandrill")
{
function = delegate { HoleInOne.instance.DoMandrill(eventCaller.currentEntity.beat); },
defaultLength = 4.0f,
},
new GameAction("monkey", "Monkey") new GameAction("monkey", "Monkey")
{ {
function = delegate { HoleInOne.instance.DoMonkey(eventCaller.currentEntity.beat); }, function = delegate { HoleInOne.instance.DoMonkey(eventCaller.currentEntity.beat); },
defaultLength = 3.0f, defaultLength = 3.0f,
}, },
// new GameAction("whale", "Whale") new GameAction("mandrill", "Mandrill")
// { {
// function = delegate { var e = eventCaller.currentEntity; HoleInOne.instance.Whale(e.beat, e.length, e["ease"], e["appear"]); }, function = delegate { HoleInOne.instance.DoMandrill(eventCaller.currentEntity.beat); },
// parameters = new List<Param>() defaultLength = 4.0f,
// { },
// new Param("appear", true, "Enter", "Toggle if the whale should enter or exit the scene."), new GameAction("whale", "Whale")
// new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.") {
// }, function = delegate { var e = eventCaller.currentEntity; HoleInOne.instance.Whale(e.beat, e.length, e["ease"], e["appear"]); },
// resizable = true parameters = new List<Param>()
// }, {
new Param("appear", true, "Enter", "Toggle if the whale should enter or exit the scene."),
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.")
},
resizable = true
},
}//, }//,
// new List<string>() { "rvl", "normal" }, // new List<string>() { "rvl", "normal" },
// "rvlgolf", "en", // "rvlgolf", "en",
@ -59,14 +59,13 @@ namespace HeavenStudio.Games.Loaders
namespace HeavenStudio.Games namespace HeavenStudio.Games
{ {
/// This class handles the minigame logic.
/// Minigame inherits directly from MonoBehaviour, and adds Heaven Studio specific methods to override.
public class HoleInOne : Minigame public class HoleInOne : Minigame
{ {
public Animator MonkeyAnim; public Animator MonkeyAnim;
public Animator MonkeyHeadAnim; public Animator MonkeyHeadAnim;
public Animator MandrillAnim; public Animator MandrillAnim;
public Animator GolferAnim; public Animator GolferAnim;
public GameObject Hole;
public Animator HoleAnim; public Animator HoleAnim;
public Animator GrassEffectAnim; public Animator GrassEffectAnim;
public Animator BallEffectAnim; public Animator BallEffectAnim;
@ -83,27 +82,24 @@ namespace HeavenStudio.Games
HoleInOne.instance = this; HoleInOne.instance = this;
SetupBopRegion("holeInOne", "bop", "autoBop"); SetupBopRegion("holeInOne", "bop", "autoBop");
isWhale = false; isWhale = false;
Hole.SetActive(false);
} }
public override void OnBeatPulse(double beat) public override void OnBeatPulse(double beat)
{ {
if (BeatIsInBopRegion(beat)) if (BeatIsInBopRegion(beat)) Bop(beat);
{
MonkeyAnim.DoScaledAnimationAsync("MonkeyBop", 0.5f);
MandrillAnim.DoScaledAnimationAsync("MandrillBop", 0.5f);
GolferAnim.DoScaledAnimationAsync("GolferBop", 0.5f);
}
} }
void Update() void Update()
{ {
if (!conductor.isPlaying || conductor.isPaused) return;
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
{ {
SoundByte.PlayOneShotGame("holeInOne/hole1"); // temp miss sound. Should be: whiff sound SoundByte.PlayOneShotGame("holeInOne/hole1"); // temp should be whiff
GolferAnim.Play("GolferWhiff"); GolferAnim.Play("GolferWhiff", 0, 0);
ScoreMiss();
} }
UpdateWhale(conductor.songPositionInBeatsAsDouble); // unswungSongPositionInBeatsAsDouble
} }
public void ToggleBop(double beat, float length, bool shouldBop, bool autoBop) public void ToggleBop(double beat, float length, bool shouldBop, bool autoBop)
@ -112,20 +108,25 @@ namespace HeavenStudio.Games
{ {
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
var currentBeat = beat + i;
BeatAction.New(instance, new List<BeatAction.Action>() BeatAction.New(instance, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beat + i, delegate new BeatAction.Action(currentBeat, delegate { Bop(currentBeat);})
{
MonkeyAnim.DoScaledAnimationAsync("MonkeyBop", 0.5f);
MandrillAnim.DoScaledAnimationAsync("MandrillBop", 0.5f);
GolferAnim.DoScaledAnimationAsync("GolferBop", 0.5f);
// TODO add bops for other characters
})
}); });
} }
} }
} }
public void Bop(double beat)
{
MonkeyAnim.DoScaledAnimationAsync("MonkeyBop", 1f);
MandrillAnim.DoScaledAnimationAsync("MandrillBop", 1f);
if (!GolferAnim.IsPlayingAnimationNames("GolferJust", "GolferWhiff"))
{
GolferAnim.DoScaledAnimationAsync("GolferBop", 1f);
}
}
public void Whale(double beat, float length, int ease, bool appear) public void Whale(double beat, float length, int ease, bool appear)
{ {
SoundByte.PlayOneShotGame("clappyTrio/sign"); SoundByte.PlayOneShotGame("clappyTrio/sign");
@ -135,10 +136,46 @@ namespace HeavenStudio.Games
isWhale = appear; isWhale = appear;
} }
void UpdateWhale(double beat)
{
if (beat >= whaleStartBeat)
{
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
float whaleProg = Conductor.instance.GetPositionFromBeat(whaleStartBeat, whaleLength, true);
whaleProg = Mathf.Clamp01(whaleProg);
// float whale = func(whaleLast, whaleNext, whaleProg);
}
}
public void DoMonkey(double beat)
{
//Monkey Multisound
ScheduleInput(beat, 2f, InputAction_FlickPress, MonkeySuccess, MonkeyMiss, Empty);
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("holeInOne/monkey1", beat),
new MultiSound.Sound("holeInOne/monkey2", beat + 1f)
});
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { MonkeyAnim.DoScaledAnimationAsync("MonkeyPrepare", 1f);}),
new BeatAction.Action(beat + 1f, delegate { MonkeyAnim.DoScaledAnimationAsync("MonkeyThrow", 1f);}),
new BeatAction.Action(beat + 1f, delegate { GolferAnim.DoScaledAnimationAsync("GolferPrepare", 1f);}),
new BeatAction.Action(beat + 2f, delegate {
if (!GolferAnim.IsPlayingAnimationNames("GolferJust", "GolferWhiff"))
{
GolferAnim.DoScaledAnimationAsync("GolferThrough", 1f);
SoundByte.PlayOneShotGame("holeInOne/hole3"); // temp
}
}),
});
}
public void DoMandrill(double beat) public void DoMandrill(double beat)
{ {
//Mandrill Multisound //Mandrill Multisound
ScheduleInput(beat, 3f, InputAction_FlickPress, MandrillSuccess, MandrillMiss, Nothing); ScheduleInput(beat, 3f, InputAction_FlickPress, MandrillSuccess, MandrillMiss, Empty);
MultiSound.Play(new MultiSound.Sound[] { MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("holeInOne/mandrill1", beat), new MultiSound.Sound("holeInOne/mandrill1", beat),
new MultiSound.Sound("holeInOne/mandrill2", beat + 1f), new MultiSound.Sound("holeInOne/mandrill2", beat + 1f),
@ -148,34 +185,59 @@ namespace HeavenStudio.Games
BeatAction.New(instance, new List<BeatAction.Action>() BeatAction.New(instance, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beat, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady1", 0.5f);}), new BeatAction.Action(beat, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady1", 1f);}),
new BeatAction.Action(beat + 1f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady2", 0.5f);}), new BeatAction.Action(beat + 1f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady2", 1f);}),
new BeatAction.Action(beat + 2f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady3", 0.5f);}), new BeatAction.Action(beat + 2f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady3", 1f);}),
new BeatAction.Action(beat + 2f, delegate { GolferAnim.DoScaledAnimationAsync("GolferPrepare", 0.5f);}), new BeatAction.Action(beat + 2f, delegate { GolferAnim.DoScaledAnimationAsync("GolferPrepare", 1f);}),
new BeatAction.Action(beat + 3f, delegate { GolferAnim.DoScaledAnimationAsync("GolferThrough", 0.5f);}), new BeatAction.Action(beat + 3f, delegate {
new BeatAction.Action(beat + 3f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillPitch", 0.5f);}), if (!GolferAnim.IsPlayingAnimationNames("GolferJust", "GolferWhiff"))
new BeatAction.Action(beat + 3f, delegate { MonkeyAnim.DoScaledAnimationAsync("MonkeySpin", 0.5f);}), {
GolferAnim.DoScaledAnimationAsync("GolferThrough", 1f);
SoundByte.PlayOneShotGame("holeInOne/hole3"); // temp
}
}),
new BeatAction.Action(beat + 3f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillPitch", 1f);}),
new BeatAction.Action(beat + 3f, delegate { MonkeyAnim.DoScaledAnimationAsync("MonkeySpin", 1f);}),
}); });
} }
public void DoMonkey(double beat) public void MonkeySuccess(PlayerActionEvent caller, float state)
{ {
//Monkey Multisound if (state >= 1f || state <= -1f)
ScheduleInput(beat, 2f, InputAction_FlickPress, MonkeySuccess, MonkeyMiss, Nothing); {
double beat = caller.startBeat + caller.timer;
SoundByte.PlayOneShotGame("holeInOne/mandrill1"); // temp should be barely
SoundByte.PlayOneShotGame("holeInOne/hole2", beat + 1f); // temp should be splash
MonkeyHeadAnim.DoScaledAnimationAsync("MonkeyMissHead", 1f);
GolferAnim.Play("GolferWhiff", 0, 0);
}
else
{
double beat = caller.startBeat + caller.timer;
int randomSuccess = UnityEngine.Random.Range(1,4);
MultiSound.Play(new MultiSound.Sound[] { MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("holeInOne/monkey1", beat), new MultiSound.Sound("holeInOne/monkey3", beat),
new MultiSound.Sound("holeInOne/monkey2", beat + 1f) new MultiSound.Sound((isWhale) ? "holeInOne/whale" : ("holeInOne/hole" + randomSuccess), beat + 2f)
}); });
BeatAction.New(instance, new List<BeatAction.Action>() BeatAction.New(instance, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beat, delegate { MonkeyAnim.DoScaledAnimationAsync("MonkeyPrepare", 0.5f);}), new BeatAction.Action(beat, delegate { MonkeyHeadAnim.DoScaledAnimationAsync("MonkeyJustHead", 1f);}),
new BeatAction.Action(beat + 1f, delegate { MonkeyAnim.DoScaledAnimationAsync("MonkeyThrow", 0.5f);}), new BeatAction.Action(beat, delegate { GolferAnim.Play("GolferJust", 0, 0);}),
new BeatAction.Action(beat + 1f, delegate { GolferAnim.DoScaledAnimationAsync("GolferPrepare", 0.5f);}), new BeatAction.Action(beat + 1.5f, delegate { Hole.SetActive(true);}),
new BeatAction.Action(beat + 2f, delegate { GolferAnim.DoScaledAnimationAsync("GolferThrough", 0.5f);}), new BeatAction.Action(beat + 2f, delegate { HoleAnim.DoScaledAnimationAsync("ZoomSmall" + randomSuccess, 1f);}),
}); });
}
}
public void MonkeyMiss(PlayerActionEvent caller)
{
SoundByte.PlayOneShotGame("holeInOne/whale");
MonkeyHeadAnim.DoScaledAnimationAsync("MonkeySadHead", 1f);
} }
public void MandrillSuccess(PlayerActionEvent caller, float state) public void MandrillSuccess(PlayerActionEvent caller, float state)
@ -184,12 +246,11 @@ namespace HeavenStudio.Games
{ {
double beat = caller.startBeat + caller.timer; double beat = caller.startBeat + caller.timer;
MultiSound.Play(new MultiSound.Sound[] { SoundByte.PlayOneShotGame("holeInOne/mandrill1"); // temp should be barely
new MultiSound.Sound("holeInOne/mandrill1", beat),// temp should be miss SoundByte.PlayOneShotGame("holeInOne/hole2", beat + 1f); // temp should be splash
new MultiSound.Sound("holeInOne/hole2", beat + 1f)// temp should be splash
});
GolferAnim.DoScaledAnimationAsync("GolferMiss", 1.0f);
BallEffectAnim.Play("BallEffectJust"); BallEffectAnim.Play("BallEffectJust");
GolferAnim.Play("GolferWhiff", 0, 0);
} }
else else
{ {
@ -202,9 +263,10 @@ namespace HeavenStudio.Games
BeatAction.New(instance, new List<BeatAction.Action>() BeatAction.New(instance, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beat, delegate { GolferAnim.DoScaledAnimationAsync("GolferJust", 0.5f);}), new BeatAction.Action(beat, delegate { GolferAnim.DoScaledAnimationAsync("GolferJust", 1f);}),
new BeatAction.Action(beat, delegate { BallEffectAnim.DoScaledAnimationAsync("BallEffectJust", 0.5f);}), new BeatAction.Action(beat, delegate { GolferAnim.Play("GolferJust", 0, 0);}),
new BeatAction.Action(beat + 2f, delegate { HoleAnim.DoScaledAnimationAsync("ZoomBig", 0.5f);}), new BeatAction.Action(beat + 1.5f, delegate { Hole.SetActive(true);}),
new BeatAction.Action(beat + 2f, delegate { HoleAnim.DoScaledAnimationAsync("ZoomBig", 1f);}),
}); });
} }
@ -218,46 +280,6 @@ namespace HeavenStudio.Games
GolferAnim.Play("GolferThroughMandrill"); GolferAnim.Play("GolferThroughMandrill");
} }
public void MonkeySuccess(PlayerActionEvent caller, float state) public void Empty(PlayerActionEvent caller) {}
{
if (state >= 1f || state <= -1f)
{
double beat = caller.startBeat + caller.timer;
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("holeInOne/mandrill1", beat),// temp should be miss
new MultiSound.Sound("holeInOne/hole2", beat + 1f)// temp should be splash
});
MonkeyHeadAnim.DoScaledAnimationAsync("MonkeyMissHead", 0.5f);
GolferAnim.DoScaledAnimationAsync("GolferMiss", 0.5f);
}
else
{
double beat = caller.startBeat + caller.timer;
int randomSuccess = UnityEngine.Random.Range(1,5);
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("holeInOne/monkey3", beat),
new MultiSound.Sound((isWhale) ? "holeInOne/whale" : ("holeInOne/hole" + randomSuccess), beat + 2f)
});
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { MonkeyHeadAnim.DoScaledAnimationAsync("MonkeyJustHead", 0.5f);}),
new BeatAction.Action(beat, delegate { GolferAnim.DoScaledAnimationAsync("GolferJust", 0.5f);}),
new BeatAction.Action(beat + 2f, delegate { HoleAnim.DoScaledAnimationAsync("ZoomSmall" + randomSuccess, 0.5f);}),
});
}
}
public void MonkeyMiss(PlayerActionEvent caller)
{
SoundByte.PlayOneShotGame("holeInOne/whale");
MonkeyHeadAnim.DoScaledAnimationAsync("MonkeySadHead", 0.5f);
}
public void Nothing(PlayerActionEvent caller)
{
}
} }
} }