minor change
This commit is contained in:
parent
7972e6137d
commit
efaf968e52
|
@ -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 GameAction("mandrill", "Mandrill")
|
||||
{
|
||||
function = delegate { HoleInOne.instance.DoMandrill(eventCaller.currentEntity.beat); },
|
||||
defaultLength = 4.0f,
|
||||
},
|
||||
new GameAction("monkey", "Monkey")
|
||||
{
|
||||
function = delegate { HoleInOne.instance.DoMonkey(eventCaller.currentEntity.beat); },
|
||||
defaultLength = 3.0f,
|
||||
},
|
||||
// new GameAction("whale", "Whale")
|
||||
// {
|
||||
// function = delegate { var e = eventCaller.currentEntity; HoleInOne.instance.Whale(e.beat, e.length, e["ease"], e["appear"]); },
|
||||
// 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 GameAction("mandrill", "Mandrill")
|
||||
{
|
||||
function = delegate { HoleInOne.instance.DoMandrill(eventCaller.currentEntity.beat); },
|
||||
defaultLength = 4.0f,
|
||||
},
|
||||
new GameAction("whale", "Whale")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; HoleInOne.instance.Whale(e.beat, e.length, e["ease"], e["appear"]); },
|
||||
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" },
|
||||
// "rvlgolf", "en",
|
||||
|
@ -59,14 +59,13 @@ namespace HeavenStudio.Games.Loaders
|
|||
|
||||
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 Animator MonkeyAnim;
|
||||
public Animator MonkeyHeadAnim;
|
||||
public Animator MandrillAnim;
|
||||
public Animator GolferAnim;
|
||||
public GameObject Hole;
|
||||
public Animator HoleAnim;
|
||||
public Animator GrassEffectAnim;
|
||||
public Animator BallEffectAnim;
|
||||
|
@ -83,27 +82,24 @@ namespace HeavenStudio.Games
|
|||
HoleInOne.instance = this;
|
||||
SetupBopRegion("holeInOne", "bop", "autoBop");
|
||||
isWhale = false;
|
||||
Hole.SetActive(false);
|
||||
}
|
||||
|
||||
public override void OnBeatPulse(double beat)
|
||||
{
|
||||
if (BeatIsInBopRegion(beat))
|
||||
{
|
||||
MonkeyAnim.DoScaledAnimationAsync("MonkeyBop", 0.5f);
|
||||
MandrillAnim.DoScaledAnimationAsync("MandrillBop", 0.5f);
|
||||
GolferAnim.DoScaledAnimationAsync("GolferBop", 0.5f);
|
||||
}
|
||||
|
||||
if (BeatIsInBopRegion(beat)) Bop(beat);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!conductor.isPlaying || conductor.isPaused) return;
|
||||
|
||||
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
|
||||
{
|
||||
SoundByte.PlayOneShotGame("holeInOne/hole1"); // temp miss sound. Should be: whiff sound
|
||||
GolferAnim.Play("GolferWhiff");
|
||||
ScoreMiss();
|
||||
SoundByte.PlayOneShotGame("holeInOne/hole1"); // temp should be whiff
|
||||
GolferAnim.Play("GolferWhiff", 0, 0);
|
||||
}
|
||||
UpdateWhale(conductor.songPositionInBeatsAsDouble); // unswungSongPositionInBeatsAsDouble
|
||||
}
|
||||
|
||||
public void ToggleBop(double beat, float length, bool shouldBop, bool autoBop)
|
||||
|
@ -112,19 +108,24 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
var currentBeat = beat + i;
|
||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + i, delegate
|
||||
{
|
||||
MonkeyAnim.DoScaledAnimationAsync("MonkeyBop", 0.5f);
|
||||
MandrillAnim.DoScaledAnimationAsync("MandrillBop", 0.5f);
|
||||
GolferAnim.DoScaledAnimationAsync("GolferBop", 0.5f);
|
||||
// TODO add bops for other characters
|
||||
})
|
||||
new BeatAction.Action(currentBeat, delegate { Bop(currentBeat);})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -135,10 +136,46 @@ namespace HeavenStudio.Games
|
|||
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)
|
||||
{
|
||||
//Mandrill Multisound
|
||||
ScheduleInput(beat, 3f, InputAction_FlickPress, MandrillSuccess, MandrillMiss, Nothing);
|
||||
ScheduleInput(beat, 3f, InputAction_FlickPress, MandrillSuccess, MandrillMiss, Empty);
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("holeInOne/mandrill1", beat),
|
||||
new MultiSound.Sound("holeInOne/mandrill2", beat + 1f),
|
||||
|
@ -148,34 +185,59 @@ namespace HeavenStudio.Games
|
|||
|
||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady1", 0.5f);}),
|
||||
new BeatAction.Action(beat + 1f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady2", 0.5f);}),
|
||||
new BeatAction.Action(beat + 2f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady3", 0.5f);}),
|
||||
new BeatAction.Action(beat + 2f, delegate { GolferAnim.DoScaledAnimationAsync("GolferPrepare", 0.5f);}),
|
||||
new BeatAction.Action(beat + 3f, delegate { GolferAnim.DoScaledAnimationAsync("GolferThrough", 0.5f);}),
|
||||
new BeatAction.Action(beat + 3f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillPitch", 0.5f);}),
|
||||
new BeatAction.Action(beat + 3f, delegate { MonkeyAnim.DoScaledAnimationAsync("MonkeySpin", 0.5f);}),
|
||||
new BeatAction.Action(beat, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady1", 1f);}),
|
||||
new BeatAction.Action(beat + 1f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady2", 1f);}),
|
||||
new BeatAction.Action(beat + 2f, delegate { MandrillAnim.DoScaledAnimationAsync("MandrillReady3", 1f);}),
|
||||
new BeatAction.Action(beat + 2f, delegate { GolferAnim.DoScaledAnimationAsync("GolferPrepare", 1f);}),
|
||||
new BeatAction.Action(beat + 3f, delegate {
|
||||
if (!GolferAnim.IsPlayingAnimationNames("GolferJust", "GolferWhiff"))
|
||||
{
|
||||
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
|
||||
ScheduleInput(beat, 2f, InputAction_FlickPress, MonkeySuccess, MonkeyMiss, Nothing);
|
||||
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>()
|
||||
if (state >= 1f || state <= -1f)
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { MonkeyAnim.DoScaledAnimationAsync("MonkeyPrepare", 0.5f);}),
|
||||
new BeatAction.Action(beat + 1f, delegate { MonkeyAnim.DoScaledAnimationAsync("MonkeyThrow", 0.5f);}),
|
||||
new BeatAction.Action(beat + 1f, delegate { GolferAnim.DoScaledAnimationAsync("GolferPrepare", 0.5f);}),
|
||||
new BeatAction.Action(beat + 2f, delegate { GolferAnim.DoScaledAnimationAsync("GolferThrough", 0.5f);}),
|
||||
});
|
||||
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[] {
|
||||
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", 1f);}),
|
||||
new BeatAction.Action(beat, delegate { GolferAnim.Play("GolferJust", 0, 0);}),
|
||||
new BeatAction.Action(beat + 1.5f, delegate { Hole.SetActive(true);}),
|
||||
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)
|
||||
|
@ -184,12 +246,11 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
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
|
||||
});
|
||||
GolferAnim.DoScaledAnimationAsync("GolferMiss", 1.0f);
|
||||
SoundByte.PlayOneShotGame("holeInOne/mandrill1"); // temp should be barely
|
||||
SoundByte.PlayOneShotGame("holeInOne/hole2", beat + 1f); // temp should be splash
|
||||
|
||||
BallEffectAnim.Play("BallEffectJust");
|
||||
GolferAnim.Play("GolferWhiff", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -202,9 +263,10 @@ namespace HeavenStudio.Games
|
|||
|
||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { GolferAnim.DoScaledAnimationAsync("GolferJust", 0.5f);}),
|
||||
new BeatAction.Action(beat, delegate { BallEffectAnim.DoScaledAnimationAsync("BallEffectJust", 0.5f);}),
|
||||
new BeatAction.Action(beat + 2f, delegate { HoleAnim.DoScaledAnimationAsync("ZoomBig", 0.5f);}),
|
||||
new BeatAction.Action(beat, delegate { GolferAnim.DoScaledAnimationAsync("GolferJust", 1f);}),
|
||||
new BeatAction.Action(beat, delegate { GolferAnim.Play("GolferJust", 0, 0);}),
|
||||
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");
|
||||
}
|
||||
|
||||
public void MonkeySuccess(PlayerActionEvent caller, float state)
|
||||
{
|
||||
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)
|
||||
{
|
||||
}
|
||||
public void Empty(PlayerActionEvent caller) {}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue