Tons of cleanup in TONS OF MINIGAMES!!! (#270)

* Tons of stuff...

* Drumming practice improvements

* Easing for drumming practice

* Converted TOTC to prefunction

* Split scratch o into two

* Forthington voice lines can now be played outside of air rally

* Rhythm Rally Improvements

* Air rally sound improvements

* Spawn blocks rework

* BTS ds small tweaks

* Tap Trial fixes

* More tweaks to tap trial

* Final minor tweaks
This commit is contained in:
Rapandrasmus
2023-02-14 17:31:51 +01:00
committed by GitHub
parent df11239b04
commit fe19ddc767
203 changed files with 6749 additions and 11718 deletions

View File

@ -50,12 +50,12 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("forthington voice lines", "Forthington Voice Lines")
{
function = delegate { AirRally.instance.ForthVoice(e.currentEntity["type"], e.currentEntity["type2"]); },
preFunction = delegate { AirRally.ForthVoice(e.currentEntity.beat, e.currentEntity["type"], e.currentEntity["type2"]); },
parameters = new List<Param>()
{
new Param("type", AirRally.CountSound.one, "Type", "The number Forthington will say"),
new Param("type2", AirRally.DistanceSound.close, "Type", "How far is Forthington?")
}
},
}
});
}
@ -89,6 +89,7 @@ namespace HeavenStudio.Games
bool babum;
bool shuttleActive;
public bool hasMissed;
public static List<float> queuedVoiceLines = new List<float>();
[Header("Waypoint")]
public float wayPointZForForth;
@ -102,6 +103,11 @@ namespace HeavenStudio.Games
public float beatHolder;
public Transform holderPos;
void OnDestroy()
{
if (queuedVoiceLines.Count > 0) queuedVoiceLines.Clear();
}
void Start()
{
Baxter.GetComponent<Animator>().Play("Idle");
@ -140,6 +146,24 @@ namespace HeavenStudio.Games
Rally(serveBeat + (int)f, wantSilent, lengthHolder);
}
}
if (cond.isPlaying && !cond.isPaused)
{
if (queuedVoiceLines.Count > 0)
{
for (int i = 0; i < queuedVoiceLines.Count; i++)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(queuedVoiceLines[i], delegate
{
Forthington.GetComponent<Animator>().Play("TalkShort", 0, 0);
})
});
}
queuedVoiceLines.Clear();
}
}
}
public enum DistanceSound
@ -188,85 +212,57 @@ namespace HeavenStudio.Games
shuttleScript.flyType = type;
}
//change to something more optimized
public void ForthVoice(int type, int type2)
public static void ForthVoice(float beat, int type, int type2)
{
Forthington.GetComponent<Animator>().Play("TalkShort");
if (type == 0)
if (GameManager.instance.currentGame == "airRally")
{
if(type2 == 0)
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
Jukebox.PlayOneShotGame("airRally/countIn1");
}
if(type2 == 1)
{
Jukebox.PlayOneShotGame("airRally/countIn1Far");
}
if(type2 == 2)
{
Jukebox.PlayOneShotGame("airRally/countIn1Farther");
}
if(type2 == 3)
{
Jukebox.PlayOneShotGame("airRally/countIn1Farthest");
}
new BeatAction.Action(beat, delegate
{
instance.Forthington.GetComponent<Animator>().Play("TalkShort");
})
});
}
if(type == 1)
else
{
if(type2 == 0)
{
Jukebox.PlayOneShotGame("airRally/countIn2");
}
if(type2 == 1)
{
Jukebox.PlayOneShotGame("airRally/countIn2Far");
}
if(type2 == 2)
{
Jukebox.PlayOneShotGame("airRally/countIn2Farther");
}
if(type2 == 3)
{
Jukebox.PlayOneShotGame("airRally/countIn2Farthest");
}
queuedVoiceLines.Add(beat);
}
if(type == 2)
float offset = 0f;
if (type == 2)
{
if(type2 == 0)
{
Jukebox.PlayOneShotGame("airRally/countIn3");
}
if(type2 == 1)
{
Jukebox.PlayOneShotGame("airRally/countIn3Far");
}
if(type2 == 2)
{
Jukebox.PlayOneShotGame("airRally/countIn3Farther");
}
if(type2 == 3)
{
Jukebox.PlayOneShotGame("airRally/countIn3Farthest");
}
offset = 0.107f;
}
if(type == 3)
else if (type == 3)
{
if(type2 == 0)
{
Jukebox.PlayOneShotGame("airRally/countIn4");
}
if(type2 == 1)
{
Jukebox.PlayOneShotGame("airRally/countIn4Far");
}
if(type2 == 2)
{
Jukebox.PlayOneShotGame("airRally/countIn4Farther");
}
if(type2 == 3)
{
Jukebox.PlayOneShotGame("airRally/countIn4Farthest");
}
offset = 0.051f;
}
switch (type2)
{
case (int)DistanceSound.close:
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound($"airRally/countIn{type + 1}", beat, 1, 1, false, offset),
}, forcePlay: true);
break;
case (int)DistanceSound.far:
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound($"airRally/countIn{type + 1}Far", beat, 1, 1, false, offset),
}, forcePlay: true);
break;
case (int)DistanceSound.farther:
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound($"airRally/countIn{type + 1}Farther", beat, 1, 1, false, offset),
}, forcePlay: true);
break;
case (int)DistanceSound.farthest:
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound($"airRally/countIn{type + 1}Farthest", beat, 1, 1, false, offset),
}, forcePlay: true);
break;
}
}
@ -491,8 +487,8 @@ namespace HeavenStudio.Games
var sound2 = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds2[0], beat + 3.5f),
new MultiSound.Sound(sounds2[1], beat + 4.3f), //TODO: find sound offset in seconds
new MultiSound.Sound(sounds2[2], beat + 5.4f)
new MultiSound.Sound(sounds2[1], beat + 4.5f, 1, 1, false, 0.107f),
new MultiSound.Sound(sounds2[2], beat + 5.5f, 1, 1, false, 0.051f)
};
MultiSound.Play(sound2);

View File

@ -15,9 +15,20 @@ namespace HeavenStudio.Games.Loaders
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("builtToScaleDS", "Built To Scale (DS)", "00BB00", true, false, new List<GameAction>()
{
new GameAction("spawn blocks", "Spawn Blocks")
new GameAction("spawn blocks", "Widget")
{
resizable = true
function = delegate {var e = eventCaller.currentEntity; BuiltToScaleDS.instance.MultiplePiano(e.beat, e.length, e["silent"], e["note1"], e["note2"], e["note3"], e["note4"], e["note5"], e["note6"]); },
resizable = true,
parameters = new List<Param>()
{
new Param("silent", false, "Mute Audio", "Whether the piano notes should be muted or not."),
new Param("note1", new EntityTypes.Integer(-24, 24, 0), "1st note", "The number of semitones up or down this note should be pitched"),
new Param("note2", new EntityTypes.Integer(-24, 24, 2), "2nd note", "The number of semitones up or down this note should be pitched"),
new Param("note3", new EntityTypes.Integer(-24, 24, 4), "3rd note", "The number of semitones up or down this note should be pitched"),
new Param("note4", new EntityTypes.Integer(-24, 24, 5), "4th note", "The number of semitones up or down this note should be pitched"),
new Param("note5", new EntityTypes.Integer(-24, 24, 7), "5th note", "The number of semitones up or down this note should be pitched"),
new Param("note6", new EntityTypes.Integer(-24, 24, 12), "6th note", "The number of semitones up or down this note should be pitched (This plays together with the 5th note)"),
}
},
new GameAction("play piano", "Play Note")
{
@ -26,7 +37,7 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>()
{
new Param("type", new EntityTypes.Integer(-24, 24, 0), "Semitones", "The number of semitones up or down this note should be pitched")
}
},
},
});
}
@ -224,5 +235,19 @@ namespace HeavenStudio.Games
pianoSource.SetLoopParams(beat + length, 0.1f);
}
public void MultiplePiano(float beat, float length, bool silent, int note1, int note2, int note3, int note4, int note5, int note6)
{
if (silent) return;
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { PlayPiano(beat, length, note1); }),
new BeatAction.Action(beat + length, delegate { PlayPiano(beat + length, length, note2); }),
new BeatAction.Action(beat + length * 2, delegate { PlayPiano(beat + length * 2, length, note3); }),
new BeatAction.Action(beat + length * 3, delegate { PlayPiano(beat + length * 3, length, note4); }),
new BeatAction.Action(beat + length * 4, delegate { PlayPiano(beat + length * 4, 1f, note5); }),
new BeatAction.Action(beat + length * 4, delegate { PlayPiano(beat + length * 4, 1f, note6); }),
});
}
}
}

View File

@ -44,12 +44,20 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("scratch-o hey", "Scratch-o")
{
function = delegate { DJSchool.instance.ScratchoHey(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"], eventCaller.currentEntity["toggle"]); },
function = delegate { DJSchool.instance.ScratchoHey(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); },
defaultLength = 3f,
parameters = new List<Param>()
{
new Param("type", DJSchool.DJVoice.Standard, "Voice", "The voice line to play"),
new Param("toggle", false, "Fast Hey", "Activate Remix 4 (DS) beat")
}
},
new GameAction("scratch-o hey fast", "Scratch-o (Remix 4)")
{
function = delegate { DJSchool.instance.ScratchoHey(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"], true); },
defaultLength = 2.5f,
parameters = new List<Param>()
{
new Param("type", DJSchool.DJVoice.Standard, "Voice", "The voice line to play"),
}
},
new GameAction("dj voice lines", "DJ Yellow Banter")
@ -68,7 +76,7 @@ namespace HeavenStudio.Games.Loaders
defaultLength = 0.5f,
parameters = new List<Param>()
{
new Param("toggle", false, "Radio FX", "Toggle on and off for Radio Effects")
new Param("toggle", true, "Radio FX", "Toggle on and off for Radio Effects")
}
}
},
@ -346,7 +354,7 @@ namespace HeavenStudio.Games
ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty);
}
public void ScratchoHey(float beat, int type, bool remix4)
public void ScratchoHey(float beat, int type, bool remix4 = false)
{
string[] sounds = new string[] { };

View File

@ -81,9 +81,9 @@ namespace HeavenStudio.Games.Scripts_DrummingPractice
if (!hitting)
{
if (count % 2 == 0)
animator.Play("HitLeft", 0, 0);
animator.DoScaledAnimationAsync("HitLeft", 0.6f);
else
animator.Play("HitRight", 0, 0);
animator.DoScaledAnimationAsync("HitRight", 0.6f);
count++;
if (player && !force)

View File

@ -17,7 +17,7 @@ namespace HeavenStudio.Games.Loaders
new GameAction("bop", "Bop")
{
function = delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.SetBop(e.beat, e.length); },
defaultLength = 0.5f,
defaultLength = 1f,
resizable = true
},
new GameAction("drum", "Hit Drum")
@ -41,6 +41,17 @@ namespace HeavenStudio.Games.Loaders
new Param("toggle", false, "Set All to Player", "Sets all Miis to the Player's Mii")
}
},
new GameAction("move npc drummers", "NPC Drummers Enter or Exit")
{
function = delegate {var e = eventCaller.currentEntity; DrummingPractice.instance.NPCDrummersEnterOrExit(e.beat, e.length, e["exit"], e["ease"]); },
defaultLength = 4f,
resizable = true,
parameters = new List<Param>()
{
new Param("exit", false, "Exit?", "Should the NPC drummers exit or enter?"),
new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the movement have?")
}
},
new GameAction("set background color", "Set Background Color")
{
function = delegate {var e = eventCaller.currentEntity; DrummingPractice.instance.SetBackgroundColor(e["colorA"], e["colorB"], e["colorC"]); },
@ -86,6 +97,14 @@ namespace HeavenStudio.Games
public Drummer leftDrummer;
public Drummer rightDrummer;
public GameObject hitPrefab;
[SerializeField] Animator NPCDrummers;
[Header("Variables")]
float movingLength;
float movingStartBeat;
bool isMoving;
string moveAnim;
EasingFunction.Ease lastEase;
public GameEvent bop = new GameEvent();
public int count = 0;
@ -109,14 +128,23 @@ namespace HeavenStudio.Games
private void Update()
{
if (Conductor.instance.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (Conductor.instance.songPositionInBeats >= bop.startBeat && Conductor.instance.songPositionInBeats < bop.startBeat + bop.length)
if (cond.songPositionInBeats >= bop.startBeat && Conductor.instance.songPositionInBeats < bop.startBeat + bop.length)
{
Bop();
}
}
if (isMoving && cond.isPlaying && !cond.isPaused)
{
float normalizedBeat = cond.GetPositionFromBeat(movingStartBeat, movingLength);
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase);
float newPos = func(0f, 1f, normalizedBeat);
NPCDrummers.DoNormalizedAnimation(moveAnim, newPos);
}
foreach (SpriteRenderer streak in streaks)
{
Color col = streak.color;
@ -124,6 +152,19 @@ namespace HeavenStudio.Games
}
}
public void NPCDrummersEnterOrExit(float beat, float length, bool exit, int ease)
{
movingStartBeat = beat;
movingLength = length;
moveAnim = exit ? "NPCDrummersExit" : "NPCDrummersEnter";
isMoving = true;
lastEase = (EasingFunction.Ease)ease;
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + length - 0.01f, delegate { isMoving = false; })
});
}
public void SetBop(float beat, float length)
{
bop.startBeat = beat;

View File

@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("whistle", "Whistle")
{
function = delegate { RhythmRally.instance.PlayWhistle(); },
preFunction = delegate { RhythmRally.PlayWhistle(eventCaller.currentEntity.beat); },
defaultLength = 0.5f
},
new GameAction("toss ball", "Toss Ball")
@ -45,13 +45,21 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("fast rally", "Fast Rally")
{
function = delegate { RhythmRally.instance.PrepareFastRally(eventCaller.currentEntity.beat, RhythmRally.RallySpeed.Fast); },
defaultLength = 6f
function = delegate { RhythmRally.instance.PrepareFastRally(eventCaller.currentEntity.beat, RhythmRally.RallySpeed.Fast, eventCaller.currentEntity["muteAudio"]); },
defaultLength = 6f,
parameters = new List<Param>()
{
new Param("muteAudio", false, "Mute Cowbell", "Whether the cowbell sound should play or not.")
}
},
new GameAction("superfast rally", "Superfast Rally")
{
function = delegate { RhythmRally.instance.PrepareFastRally(eventCaller.currentEntity.beat, RhythmRally.RallySpeed.SuperFast); },
defaultLength = 12f
function = delegate { RhythmRally.instance.PrepareFastRally(eventCaller.currentEntity.beat, RhythmRally.RallySpeed.SuperFast, eventCaller.currentEntity["muteAudio"]); },
defaultLength = 12f,
parameters = new List<Param>()
{
new Param("muteAudio", false, "Mute Cowbell", "Whether the cowbell sound should play or not.")
}
},
new GameAction("pose", "End Pose")
{
@ -428,9 +436,12 @@ namespace HeavenStudio.Games
ball.SetActive(false);
}
public void PlayWhistle()
public static void PlayWhistle(float beat)
{
Jukebox.PlayOneShotGame("rhythmRally/Whistle");
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("rhythmRally/Whistle", beat),
}, forcePlay: true);
}
public void Pose()
@ -448,7 +459,7 @@ namespace HeavenStudio.Games
cameraPivot.DOScale(camZoom, len).SetEase(ease);
}
public void PrepareFastRally(float beat, RallySpeed speedChange)
public void PrepareFastRally(float beat, RallySpeed speedChange, bool muteAudio = false)
{
if (speedChange == RallySpeed.Fast)
{
@ -457,6 +468,7 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat + 2f, delegate { Serve(beat + 2f, RallySpeed.Fast); })
});
if (muteAudio) return;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("rhythmRally/Tonk", beat),
@ -474,6 +486,7 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat + 10f, delegate { Serve(beat + 10f, RallySpeed.SuperFast); })
});
if (muteAudio) return;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("rhythmRally/Tonk", beat),

View File

@ -15,17 +15,56 @@ namespace HeavenStudio.Games.Loaders
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("samuraiSliceNtr", "Samurai Slice (DS)", "00165D", false, false, new List<GameAction>()
{
//backwards compatibility
new GameAction("spawn object", "Toss Object")
{
function = delegate
{
SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"], (int) eventCaller.currentEntity["valA"]);
},
},
defaultLength = 8,
parameters = new List<Param>()
{
new Param("type", SamuraiSliceNtr.ObjectType.Melon, "Object", "The object to spawn"),
new Param("valA", new EntityTypes.Integer(0, 30, 1), "Money", "The amount of coins the object spills out when sliced"),
new Param("valA", new EntityTypes.Integer(0, 30, 1), "Money", "The amount of coins the melon spills out when sliced"),
},
hidden = true
},
new GameAction("melon", "Melon")
{
function = delegate
{
SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, (int)SamuraiSliceNtr.ObjectType.Melon, (int) eventCaller.currentEntity["valA"], eventCaller.currentEntity["2b2t"]);
},
defaultLength = 5,
parameters = new List<Param>()
{
new Param("2b2t", false, "Melon2B2T", "Should the melon be reskinned as the 2B2T melon?"),
new Param("valA", new EntityTypes.Integer(0, 30, 1), "Money", "The amount of coins the melon spills out when sliced"),
}
},
new GameAction("fish", "Fish")
{
function = delegate
{
SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, (int)SamuraiSliceNtr.ObjectType.Fish, (int) eventCaller.currentEntity["valA"]);
},
defaultLength = 7,
parameters = new List<Param>()
{
new Param("valA", new EntityTypes.Integer(0, 30, 1), "Money", "The amount of coins the fish spills out when sliced"),
}
},
new GameAction("demon", "Demon")
{
function = delegate
{
SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, (int)SamuraiSliceNtr.ObjectType.Demon, (int) eventCaller.currentEntity["valA"]);
},
defaultLength = 7,
parameters = new List<Param>()
{
new Param("valA", new EntityTypes.Integer(0, 30, 1), "Money", "The amount of coins the demon spills out when sliced"),
}
},
},
@ -123,12 +162,12 @@ namespace HeavenStudio.Games
bop.startBeat = beat;
}
public void ObjectIn(float beat, int type = (int) ObjectType.Melon, int value = 1)
public void ObjectIn(float beat, int type = (int) ObjectType.Melon, int value = 1, bool funnyMinecraft = false)
{
var mobj = GameObject.Instantiate(objectPrefab, objectHolder);
var mobjDat = mobj.GetComponent<NtrSamuraiObject>();
mobjDat.startBeat = beat;
mobjDat.type = type;
mobjDat.type = funnyMinecraft ? (int)ObjectType.Melon2B2T : type;
mobjDat.holdingCash = value;
mobj.SetActive(true);

View File

@ -12,7 +12,7 @@ namespace HeavenStudio.Games.Loaders
public static class AgbTapLoader
{
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("tapTrial", "Tap Trial \n<color=#eb5454>[WIP]</color>", "93ffb3", false, false, new List<GameAction>()
return new Minigame("tapTrial", "Tap Trial", "93ffb3", false, false, new List<GameAction>()
{
new GameAction("bop", "Bop")
{
@ -20,7 +20,7 @@ namespace HeavenStudio.Games.Loaders
defaultLength = .5f,
parameters = new List<Param>()
{
new Param("toggle", true, "Bop", "Whether both will bop to the beat or not")
new Param("toggle", false, "Bop", "Whether both will bop to the beat or not")
}
},
new GameAction("tap", "Tap")
@ -61,23 +61,23 @@ namespace HeavenStudio.Games.Loaders
new GameAction("scroll event", "Scroll Background")
{
function = delegate { TapTrial.instance.scrollEvent(eventCaller.currentEntity["toggle"], eventCaller.currentEntity["toggle"]); },
function = delegate { TapTrial.instance.scrollEvent(eventCaller.currentEntity["toggle"], eventCaller.currentEntity["flash"]); },
defaultLength = .5f,
parameters = new List<Param>()
{
new Param("toggle", false, "Scroll FX", "Will scroll"),
new Param("toggle", false, "Flash FX", "Will flash to white"),
new Param("toggle", true, "Scroll FX", "Will scroll"),
new Param("flash", false, "Flash FX", "Will flash to white"),
}
},
new GameAction("giraffe events", "Giraffe Animations")
{
function = delegate { TapTrial.instance.giraffeEvent(eventCaller.currentEntity["toggle"], eventCaller.currentEntity["toggle"]); },
function = delegate { TapTrial.instance.giraffeEvent(eventCaller.currentEntity["instant"]); },
defaultLength = .5f,
parameters = new List<Param>()
{
new Param("toggle", false, "Enter", "Giraffe will enter the scene"),
new Param("toggle", false, "Exit", "Giraffe will exit the scene"),
new Param("toggle", true, "Enter?", "Giraffe will enter the scene"),
new Param("instant", false, "Instant", "Will the giraffe enter/exit instantly?")
}
}
});
@ -105,7 +105,7 @@ namespace HeavenStudio.Games
[SerializeField] SpriteRenderer flash;
[SerializeField] ScrollForTap scroll;
[SerializeField] GameObject giraffe;
bool goBop, isPrep;
bool goBop = true, isPrep;
float lastReportedBeat = 0f;
bool hasJumped, isFinalJump;
public float jumpStartTime = Single.MinValue;
@ -129,9 +129,9 @@ namespace HeavenStudio.Games
{
if (Conductor.instance.ReportBeat(ref lastReportedBeat))
{
monkeys[0].Play("Bop", 0, 0);
monkeys[1].Play("Bop", 0, 0);
player.anim.Play("Bop", 0, 0);
if (isPlaying(monkeys[0], "Idle")) monkeys[0].DoScaledAnimationAsync("Bop", 0.5f);
if (isPlaying(monkeys[1], "Idle")) monkeys[1].DoScaledAnimationAsync("Bop", 0.5f);
if (isPlaying(player.anim, "Idle")) player.anim.DoScaledAnimationAsync("Bop", 0.5f);
}
else if (Conductor.instance.songPositionInBeats < lastReportedBeat)
{
@ -166,40 +166,32 @@ namespace HeavenStudio.Games
//Jukebox.PlayOneShotGame("fanClub/landing_impact", pitch: UnityEngine.Random.Range(0.95f, 1f), volume: 1f / 4);
}
hasJumped = false;
}
if (PlayerInput.Pressed() && !IsExpectingInputNow())
{
player.anim.Play("Tap", 0, 0);
Jukebox.PlayOneShotGame("tapTrial/tonk");
if (PlayerInput.Pressed() && !IsExpectingInputNow())
{
player.anim.Play("Tap", 0, 0);
Jukebox.PlayOneShotGame("tapTrial/tonk");
}
}
}
public void Bop(bool isBopping)
{
if (isBopping)
{
goBop = true;
}
else
{
goBop = false;
}
goBop = isBopping;
}
public void Tap(float beat)
{
isPrep = true;
Jukebox.PlayOneShotGame("tapTrial/ook");
player.anim.Play("TapPrepare", 0, 0);
player.anim.DoScaledAnimationAsync("TapPrepare", 0.5f);
//Monkey Tap Prepare Anim
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { monkeys[0].Play("TapPrepare"); }),
new BeatAction.Action(beat, delegate { monkeys[1].Play("TapPrepare"); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].Play("Tap"); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[1].Play("Tap"); }),
new BeatAction.Action(beat, delegate { monkeys[0].DoScaledAnimationAsync("TapPrepare", 0.5f); }),
new BeatAction.Action(beat, delegate { monkeys[1].DoScaledAnimationAsync("TapPrepare", 0.5f); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].DoScaledAnimationAsync("Tap", 0.6f); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[1].DoScaledAnimationAsync("Tap", 0.6f); }),
});
//CreateTap(beat);
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, OnTap, OnTapMiss, OnEmpty);
@ -219,27 +211,29 @@ namespace HeavenStudio.Games
new MultiSound.Sound("tapTrial/ookook", beat + 0.5f)
});
player.anim.Play("DoubleTapPrepare", 0, 0);
player.anim.DoScaledAnimationAsync("DoubleTapPrepare", 0.5f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { monkeys[0].Play("DoubleTapPrepare", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[0].Play("DoubleTapPrepare_2", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].Play("DoubleTap", 0, 0); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1.5f, delegate { monkeys[0].Play("DoubleTap", 0, 0); particleEffectMonkeys(); }),
new BeatAction.Action(beat, delegate { monkeys[0].DoScaledAnimationAsync("DoubleTapPrepare", 0.5f); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[0].DoScaledAnimationAsync("DoubleTapPrepare_2", 0.5f); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].DoScaledAnimationAsync("DoubleTap", 0.6f); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1.5f, delegate { monkeys[0].DoScaledAnimationAsync("DoubleTap", 0.6f); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1.99f, delegate {monkeys[0].Play("Idle", 0, 0); }),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { monkeys[1].Play("DoubleTapPrepare", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[1].Play("DoubleTapPrepare_2", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[1].Play("DoubleTap", 0, 0); }),
new BeatAction.Action(beat + 1.5f, delegate { monkeys[1].Play("DoubleTap", 0, 0); }),
new BeatAction.Action(beat, delegate { monkeys[1].DoScaledAnimationAsync("DoubleTapPrepare", 0.5f); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[1].DoScaledAnimationAsync("DoubleTapPrepare_2", 0.5f); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[1].DoScaledAnimationAsync("DoubleTap", 0.6f); }),
new BeatAction.Action(beat + 1.5f, delegate { monkeys[1].DoScaledAnimationAsync("DoubleTap", 0.6f); }),
new BeatAction.Action(beat + 1.99f, delegate {monkeys[1].Play("Idle", 0, 0); }),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 4f, delegate { isPrep = false; })
new BeatAction.Action(beat + 1.99f, delegate { isPrep = false; })
});
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, OnDoubleTap, OnTapMiss, OnEmpty);
@ -358,17 +352,19 @@ namespace HeavenStudio.Games
});
}
public void giraffeEvent(bool enter, bool exit)
public void giraffeEvent(bool instant)
{
if (enter && !giraffeIsIn)
float animTime = 0;
if (instant) animTime = 1;
if (!giraffeIsIn)
{
giraffe.SetActive(true);
giraffe.GetComponent<Animator>().Play("Enter", 0, 0);
giraffe.GetComponent<Animator>().Play("Enter", 0, animTime);
giraffeIsIn = true;
}
else if (exit && giraffeIsIn)
else if (giraffeIsIn)
{
giraffe.GetComponent<Animator>().Play("Exit", 0, 0);
giraffe.GetComponent<Animator>().Play("Exit", 0, animTime);
giraffeIsIn = false;
}
}
@ -400,13 +396,13 @@ namespace HeavenStudio.Games
public void OnTap(PlayerActionEvent caller, float beat)
{
Jukebox.PlayOneShotGame("tapTrial/tap");
player.anim.Play("Tap", 0, 0);
player.anim.DoScaledAnimationAsync("Tap", 0.6f);
player_effects[0].GetComponent<ParticleSystem>().Play();
}
public void OnDoubleTap(PlayerActionEvent caller, float beat)
{
Jukebox.PlayOneShotGame("tapTrial/tap");
player.anim.Play("DoubleTap", 0, 0);
player.anim.DoScaledAnimationAsync("DoubleTap", 0.6f);
player_effects[1].GetComponent<ParticleSystem>().Play();
}
@ -493,6 +489,14 @@ namespace HeavenStudio.Games
}
#endregion
bool isPlaying(Animator anim, string stateName)
{
if (anim.GetCurrentAnimatorStateInfo(0).IsName(stateName) &&
anim.GetCurrentAnimatorStateInfo(0).normalizedTime < 1.0f)
return true;
else
return false;
}
//this is the orig way for input handling
//public void CreateTap(float beat, int type = 0)

View File

@ -15,17 +15,21 @@ namespace HeavenStudio.Games.Loaders
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("trickClass", "Trick on the Class", "C0171D", false, false, new List<GameAction>()
{
new GameAction("toss", "Toss Object")
new GameAction("toss", "Paper Ball")
{
function = delegate
preFunction = delegate
{
TrickClass.instance.TossObject(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]);
TrickClass.PreTossObject(eventCaller.currentEntity.beat, (int)TrickClass.TrickObjType.Ball);
},
defaultLength = 3,
parameters = new List<Param>()
defaultLength = 2,
},
new GameAction("plane", "Plane")
{
preFunction = delegate
{
new Param("type", TrickClass.TrickObjType.Ball, "Object", "The object to toss")
}
TrickClass.PreTossObject(eventCaller.currentEntity.beat, (int)TrickClass.TrickObjType.Plane);
},
defaultLength = 3,
},
new GameAction("bop", "")
{
@ -51,6 +55,12 @@ namespace HeavenStudio.Games
Ball,
Plane,
}
public struct QueuedObject
{
public float beat;
public int type;
}
public static List<QueuedObject> queuedInputs = new List<QueuedObject>();
[Header("Objects")]
public Animator playerAnim;
@ -77,6 +87,12 @@ namespace HeavenStudio.Games
float playerBopStart = Single.MinValue;
float girlBopStart = Single.MinValue;
void OnDestroy()
{
if (queuedInputs.Count > 0) queuedInputs.Clear();
}
private void Awake()
{
instance = this;
@ -94,35 +110,42 @@ namespace HeavenStudio.Games
girlAnim.DoScaledAnimationAsync("Bop");
}
if (cond.isPlaying && !cond.isPaused)
{
if (queuedInputs.Count > 0)
{
foreach (var input in queuedInputs)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(input.beat - 1f, delegate
{
switch (input.type)
{
case (int)TrickClass.TrickObjType.Ball:
warnAnim.Play("WarnBall", 0, 0);
break;
case (int)TrickClass.TrickObjType.Plane:
warnAnim.Play("WarnPlane", 0, 0);
break;
}
}),
new BeatAction.Action(input.beat, delegate
{
warnAnim.Play("NoPose", 0, 0);
TossObject(input.beat, input.type);
})
});
}
queuedInputs.Clear();
}
}
if (PlayerInput.Pressed() && !IsExpectingInputNow() && (playerCanDodge <= Conductor.instance.songPositionInBeats))
{
PlayerDodge(true);
playerCanDodge = Conductor.instance.songPositionInBeats + 0.6f;
}
// bruh
var tossEvents = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "trickClass/toss");
for (int i = 0; i < tossEvents.Count; i++)
{
var e = tossEvents[i];
float timeToEvent = e.beat - cond.songPositionInBeats;
warnAnim.Play("NoPose", -1, 0);
if (timeToEvent > 0f && timeToEvent <= 1f)
{
string anim = "WarnBall";
switch (e["type"])
{
case (int) TrickObjType.Plane:
anim = "WarnPlane";
break;
default:
anim = "WarnBall";
break;
}
warnAnim.DoScaledAnimation(anim, e.beat - 1f, 1f);
break;
}
}
}
public void Bop(float beat, float length)
@ -131,6 +154,41 @@ namespace HeavenStudio.Games
bop.length = length;
}
public static void PreTossObject(float beat, int type)
{
if (GameManager.instance.currentGame == "trickClass")
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat - 1, delegate
{
switch (type)
{
case (int)TrickClass.TrickObjType.Ball:
instance.warnAnim.Play("WarnBall", 0, 0);
break;
case (int)TrickClass.TrickObjType.Plane:
instance.warnAnim.Play("WarnPlane", 0, 0);
break;
}
}),
new BeatAction.Action(beat, delegate
{
instance.warnAnim.Play("NoPose", 0, 0);
instance.TossObject(beat, type);
})
});
}
else
{
queuedInputs.Add(new QueuedObject
{
beat = beat,
type = type,
});
}
}
public void TossObject(float beat, int type)
{
switch (type)