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

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