mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 11:47:40 +02:00
Trick on the Class Overhaul (#619)
* totc internal systems rework add chair, shock * shock near miss * phone * start optic blast switch phone variant * optic blast chrono sorting takes mobile into account
This commit is contained in:
@ -12,16 +12,26 @@ namespace HeavenStudio.Games.Loaders
|
||||
using static Minigames;
|
||||
public static class MobTrickLoader
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller) {
|
||||
public static Minigame AddGame(EventCaller eventCaller)
|
||||
{
|
||||
return new Minigame("trickClass", "Trick on the Class", "ecede4", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("toss", "Paper Ball")
|
||||
new GameAction("toss", "Toss Object")
|
||||
{
|
||||
preFunction = delegate
|
||||
{
|
||||
TrickClass.PreTossObject(eventCaller.currentEntity.beat, (int)TrickClass.TrickObjType.Ball);
|
||||
},
|
||||
var e = eventCaller.currentEntity;
|
||||
TrickClass.PreTossObject(e.beat, (int)e["obj"], e["nx"]);
|
||||
},
|
||||
defaultLength = 2,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("obj", TrickClass.TrickObjTypeEditor.PaperBall, "Object", "Changes the object thrown at the player", new List<Param.CollapseParam>()
|
||||
{
|
||||
new Param.CollapseParam((x, _) => (int)x == (int)TrickClass.TrickObjTypeEditor.Phone, new string[] { "nx" }),
|
||||
}),
|
||||
new Param("nx", false, "Switch", "Replace the phone with a Switch"),
|
||||
}
|
||||
},
|
||||
new GameAction("plane", "Plane")
|
||||
{
|
||||
@ -31,20 +41,59 @@ namespace HeavenStudio.Games.Loaders
|
||||
},
|
||||
defaultLength = 3,
|
||||
},
|
||||
new GameAction("blast", "Optic Blast")
|
||||
{
|
||||
preFunction = delegate
|
||||
{
|
||||
TrickClass.PreBlast(eventCaller.currentEntity.beat);
|
||||
},
|
||||
defaultLength = 4,
|
||||
},
|
||||
new GameAction("bop", "Bop")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; TrickClass.instance.Bop(e.beat, e.length, e["bop"], e["autoBop"]); },
|
||||
resizable = true,
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("bop", true, "Bop", "Should the girl and boy bop?"),
|
||||
new Param("autoBop", false, "Bop (Auto)", "Should the girl and boy auto bop?")
|
||||
}
|
||||
},
|
||||
new GameAction("chair", "Chair")
|
||||
{
|
||||
preFunction = delegate
|
||||
{
|
||||
TrickClass.PreTossObject(eventCaller.currentEntity.beat, (int)TrickClass.TrickObjType.Chair);
|
||||
},
|
||||
defaultLength = 2,
|
||||
hidden = true,
|
||||
},
|
||||
new GameAction("phone", "Phone")
|
||||
{
|
||||
preFunction = delegate
|
||||
{
|
||||
TrickClass.PreTossObject(eventCaller.currentEntity.beat, (int)TrickClass.TrickObjType.Phone, eventCaller.currentEntity["nx"]);
|
||||
},
|
||||
defaultLength = 2,
|
||||
hidden = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("nx", false, "Switch", "Replace the phone with a Switch"),
|
||||
}
|
||||
},
|
||||
new GameAction("shock", "Lightning Bolt")
|
||||
{
|
||||
preFunction = delegate
|
||||
{
|
||||
TrickClass.PreTossObject(eventCaller.currentEntity.beat, (int)TrickClass.TrickObjType.Shock);
|
||||
},
|
||||
defaultLength = 2,
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
new List<string>() {"mob", "normal"},
|
||||
new List<string>() { "mob", "normal" },
|
||||
"mobtrick", "en",
|
||||
new List<string>() {}
|
||||
new List<string>() { }
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -59,15 +108,29 @@ namespace HeavenStudio.Games
|
||||
using Scripts_TrickClass;
|
||||
public class TrickClass : Minigame
|
||||
{
|
||||
public enum TrickObjType {
|
||||
public enum TrickObjTypeEditor : int
|
||||
{
|
||||
PaperBall,
|
||||
Chair,
|
||||
Lightning,
|
||||
Phone,
|
||||
}
|
||||
public enum TrickObjType : int
|
||||
{
|
||||
Ball,
|
||||
Chair,
|
||||
Shock,
|
||||
Phone,
|
||||
Plane,
|
||||
Blast
|
||||
}
|
||||
public struct QueuedObject
|
||||
{
|
||||
public double beat;
|
||||
public int type;
|
||||
public bool variant;
|
||||
}
|
||||
|
||||
public static List<QueuedObject> queuedInputs = new List<QueuedObject>();
|
||||
|
||||
[Header("Objects")]
|
||||
@ -76,9 +139,11 @@ namespace HeavenStudio.Games
|
||||
public Animator warnAnim;
|
||||
|
||||
[Header("References")]
|
||||
public GameObject ballPrefab;
|
||||
public GameObject planePrefab;
|
||||
public GameObject shockPrefab;
|
||||
public GameObject[] objPrefab;
|
||||
public GameObject[] objPrefabVariant;
|
||||
public string[] objWarnAnim;
|
||||
public string[] objWarnAnimVariant;
|
||||
public string[] objThrowAnim;
|
||||
public Transform objHolder;
|
||||
|
||||
[Header("Curves")]
|
||||
@ -96,7 +161,7 @@ namespace HeavenStudio.Games
|
||||
double playerBopStart = double.MinValue;
|
||||
double girlBopStart = double.MinValue;
|
||||
bool showBubble = true;
|
||||
bool playerReady;
|
||||
bool playerReady, girlBopEnable;
|
||||
|
||||
public static PlayerInput.InputAction InputAction_TouchPressing =
|
||||
new("PcoTrickTouching", new int[] { IAEmptyCat, IAPressingCat, IAEmptyCat },
|
||||
@ -115,6 +180,7 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
instance = this;
|
||||
SetupBopRegion("trickClass", "bop", "autoBop");
|
||||
girlBopEnable = true;
|
||||
}
|
||||
|
||||
public override void OnBeatPulse(double beat)
|
||||
@ -124,7 +190,7 @@ namespace HeavenStudio.Games
|
||||
if ((!playerReady) && cond.songPositionInBeatsAsDouble > playerBopStart)
|
||||
playerAnim.DoScaledAnimationAsync("Bop");
|
||||
|
||||
if (cond.songPositionInBeatsAsDouble > girlBopStart)
|
||||
if (cond.songPositionInBeatsAsDouble > girlBopStart && girlBopEnable)
|
||||
girlAnim.DoScaledAnimationAsync("Bop");
|
||||
}
|
||||
|
||||
@ -141,24 +207,16 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
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;
|
||||
}
|
||||
warnAnim.Play(input.variant ? objWarnAnimVariant[input.type] : objWarnAnim[input.type], 0, 0);
|
||||
}),
|
||||
new BeatAction.Action(input.beat, delegate
|
||||
new BeatAction.Action(input.beat, delegate
|
||||
{
|
||||
warnAnim.Play("NoPose", 0, 0);
|
||||
TossObject(input.beat, input.type);
|
||||
TossObject(input.beat, input.type, input.variant);
|
||||
})
|
||||
});
|
||||
}
|
||||
queuedInputs.Clear();
|
||||
queuedInputs.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,32 +265,24 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
instance.showBubble = !instance.showBubble;
|
||||
}
|
||||
|
||||
public static void PreTossObject(double beat, int type)
|
||||
|
||||
public static void PreTossObject(double beat, int type, bool variant = false)
|
||||
{
|
||||
if (GameManager.instance.currentGame == "trickClass")
|
||||
{
|
||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat - 1, delegate
|
||||
new BeatAction.Action(beat - 1, delegate
|
||||
{
|
||||
if (instance.showBubble == true)
|
||||
{
|
||||
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;
|
||||
}
|
||||
instance.warnAnim.Play(variant ? instance.objWarnAnimVariant[type] : instance.objWarnAnim[type], 0, 0);
|
||||
}
|
||||
}),
|
||||
new BeatAction.Action(beat, delegate
|
||||
new BeatAction.Action(beat, delegate
|
||||
{
|
||||
instance.warnAnim.Play("NoPose", 0, 0);
|
||||
instance.TossObject(beat, type);
|
||||
instance.TossObject(beat, type, variant);
|
||||
})
|
||||
});
|
||||
}
|
||||
@ -242,78 +292,187 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
beat = beat,
|
||||
type = type,
|
||||
variant = variant
|
||||
});
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case (int)TrickObjType.Plane:
|
||||
PlaySoundSequence("trickClass", "planeThrow", beat);
|
||||
break;
|
||||
case (int)TrickObjType.Chair:
|
||||
PlaySoundSequence("trickClass", "chairThrow", beat);
|
||||
break;
|
||||
case (int)TrickObjType.Shock:
|
||||
PlaySoundSequence("trickClass", "shockThrow", beat);
|
||||
break;
|
||||
case (int)TrickObjType.Phone:
|
||||
PlaySoundSequence("trickClass", "phoneThrow", beat);
|
||||
break;
|
||||
default:
|
||||
PlaySoundSequence("trickClass", "ballThrow", beat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void TossObject(double beat, int type)
|
||||
public void TossObject(double beat, int type, bool variant = false)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case (int) TrickObjType.Plane:
|
||||
SoundByte.PlayOneShotGame("trickClass/girl_toss_plane");
|
||||
break;
|
||||
default:
|
||||
SoundByte.PlayOneShotGame("trickClass/girl_toss_ball");
|
||||
break;
|
||||
}
|
||||
SpawnObject(beat, type);
|
||||
SpawnObject(beat, type, variant);
|
||||
|
||||
girlAnim.DoScaledAnimationAsync("Throw");
|
||||
girlAnim.DoScaledAnimationAsync(objThrowAnim[type]);
|
||||
girlBopStart = Conductor.instance.songPositionInBeatsAsDouble + 0.75f;
|
||||
}
|
||||
|
||||
public void SpawnObject(double beat, int type)
|
||||
public void SpawnObject(double beat, int type, bool variant = false)
|
||||
{
|
||||
GameObject objectToSpawn;
|
||||
BezierCurve3D curve;
|
||||
bool isPlane = false;
|
||||
switch (type)
|
||||
{
|
||||
case (int) TrickObjType.Plane:
|
||||
objectToSpawn = planePrefab;
|
||||
case (int)TrickObjType.Plane:
|
||||
curve = planeTossCurve;
|
||||
isPlane = true;
|
||||
break;
|
||||
case (int)TrickObjType.Shock:
|
||||
curve = shockTossCurve;
|
||||
break;
|
||||
default:
|
||||
objectToSpawn = ballPrefab;
|
||||
curve = ballTossCurve;
|
||||
break;
|
||||
}
|
||||
var mobj = GameObject.Instantiate(objectToSpawn, objHolder);
|
||||
objectToSpawn = variant ? objPrefabVariant[type] : objPrefab[type];
|
||||
var mobj = Instantiate(objectToSpawn, objHolder);
|
||||
var thinker = mobj.GetComponent<MobTrickObj>();
|
||||
|
||||
thinker.startBeat = beat;
|
||||
thinker.flyType = isPlane;
|
||||
thinker.curve = curve;
|
||||
thinker.type = type;
|
||||
// thinker.type = type;
|
||||
|
||||
mobj.SetActive(true);
|
||||
}
|
||||
|
||||
public void PlayerDodge(bool slow = false)
|
||||
public static void PreBlast(double beat)
|
||||
{
|
||||
PlaySoundSequence("trickClass", "girlCharge", beat);
|
||||
if (GameManager.instance.currentGame == "trickClass")
|
||||
{
|
||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate
|
||||
{
|
||||
instance.DoBlast(beat);
|
||||
})
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
queuedInputs.Add(new QueuedObject
|
||||
{
|
||||
beat = beat,
|
||||
type = (int)TrickObjType.Blast,
|
||||
variant = false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void DoBlast(double beat)
|
||||
{
|
||||
ScheduleInput(beat, 2, InputAction_FlickPress, BlastJustOrNg, BlastMiss, Through, CanDodge);
|
||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate
|
||||
{
|
||||
girlBopEnable = false;
|
||||
girlAnim.DoScaledAnimationAsync("Charge0");
|
||||
}),
|
||||
new BeatAction.Action(beat + 0.75, delegate
|
||||
{
|
||||
girlAnim.DoScaledAnimationAsync("Charge1");
|
||||
}),
|
||||
new BeatAction.Action(beat + 1.5, delegate
|
||||
{
|
||||
girlAnim.DoScaledAnimationAsync("Charge1");
|
||||
}),
|
||||
new BeatAction.Action(beat + 2, delegate
|
||||
{
|
||||
//test
|
||||
// girlAnim.DoScaledAnimationAsync("BlastDodged", 0.5f);
|
||||
}),
|
||||
new BeatAction.Action(beat + 4, delegate
|
||||
{
|
||||
girlBopEnable = true;
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
public bool CanDodge()
|
||||
{
|
||||
return playerCanDodge <= Conductor.instance.songPositionInBeatsAsDouble;
|
||||
}
|
||||
|
||||
public void BlastJustOrNg(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (state <= -1f || state >= 1f)
|
||||
{
|
||||
SoundByte.PlayOneShotGame("trickClass/shock_impact");
|
||||
girlAnim.DoScaledAnimationAsync("BlastNg", 0.5f);
|
||||
PlayerDodgeNg(true);
|
||||
return;
|
||||
}
|
||||
girlAnim.DoScaledAnimationAsync("BlastDodged", 0.5f);
|
||||
if (playerCanDodge > Conductor.instance.songPositionInBeatsAsDouble) return;
|
||||
|
||||
SoundByte.PlayOneShotGame("trickClass/blast_dodge");
|
||||
playerAnim.DoScaledAnimationAsync("DodgeBlast0", 1f);
|
||||
playerBopStart = Conductor.instance.songPositionInBeatsAsDouble + 1.25;
|
||||
playerCanDodge = Conductor.instance.songPositionInBeatsAsDouble + 1;
|
||||
playerReady = false;
|
||||
|
||||
SoundByte.PlayOneShotGame("trickClass/blast_dodge_return", caller.startBeat + caller.timer + 1f);
|
||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(caller.startBeat + caller.timer + 1, delegate
|
||||
{
|
||||
playerAnim.DoScaledAnimationAsync("DodgeBlast1", 1f);
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
public void BlastMiss(PlayerActionEvent caller)
|
||||
{
|
||||
girlAnim.DoScaledAnimationAsync("BlastNg", 0.5f);
|
||||
|
||||
SoundByte.PlayOneShotGame("trickClass/blast_miss");
|
||||
|
||||
playerAnim.DoScaledAnimationAsync("ThroughBlast");
|
||||
playerReady = false;
|
||||
playerBopStart = Conductor.instance.songPositionInBeatsAsDouble + 1.5f;
|
||||
playerCanDodge = Conductor.instance.songPositionInBeatsAsDouble + 0.5f;
|
||||
}
|
||||
|
||||
public void Through(PlayerActionEvent caller) { }
|
||||
|
||||
public void PlayerDodge(bool slow = false, bool type = false)
|
||||
{
|
||||
if (playerCanDodge > Conductor.instance.songPositionInBeatsAsDouble) return;
|
||||
|
||||
//anim
|
||||
SoundByte.PlayOneShotGame("trickClass/player_dodge");
|
||||
playerAnim.DoScaledAnimationAsync("Dodge", slow ? 0.6f : 1f);
|
||||
playerAnim.DoScaledAnimationAsync(type ? "DodgeAlt" : "Dodge", slow ? 0.6f : 1f);
|
||||
playerBopStart = Conductor.instance.songPositionInBeatsAsDouble + 0.75f;
|
||||
playerReady = false;
|
||||
|
||||
}
|
||||
|
||||
public void PlayerDodgeNg()
|
||||
public void PlayerDodgeNg(bool shock = false)
|
||||
{
|
||||
playerAnim.DoScaledAnimationAsync("DodgeNg");
|
||||
playerAnim.DoScaledAnimationAsync(shock ? "DodgeNgShock" : "DodgeNg");
|
||||
playerReady = false;
|
||||
playerBopStart = Conductor.instance.songPositionInBeatsAsDouble + 0.75f;
|
||||
playerCanDodge = Conductor.instance.songPositionInBeatsAsDouble + 0.15f;
|
||||
}
|
||||
|
||||
public void PlayerThrough()
|
||||
public void PlayerThrough(bool shock = false)
|
||||
{
|
||||
playerAnim.DoScaledAnimationAsync("Through");
|
||||
playerAnim.DoScaledAnimationAsync(shock ? "ThroughShock" : "Through");
|
||||
playerReady = false;
|
||||
playerBopStart = Conductor.instance.songPositionInBeatsAsDouble + 0.75f;
|
||||
playerCanDodge = Conductor.instance.songPositionInBeatsAsDouble + 0.15f;
|
||||
|
Reference in New Issue
Block a user