Updated Inputs for some minigames

First Contact & DJ School has their inputs methods updated
This commit is contained in:
Mytiaoga
2022-07-08 13:27:10 +08:00
parent b1a491b50a
commit 614059a4d3
37 changed files with 3083 additions and 957 deletions

View File

@ -11,7 +11,11 @@ namespace HeavenStudio.Games.Loaders
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("djSchool", "DJ School", "008c97", false, false, new List<GameAction>()
{
new GameAction("bop", delegate { DJSchool.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true),
//new GameAction("bop", delegate { DJSchool.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true),
new GameAction("bop", delegate { DJSchool.instance.Bop(eventCaller.currentEntity.toggle); }, 0.5f, false, new List<Param>()
{
new Param("toggle", true, "Bop", "Whether both will bop to the beat or not")
}),
new GameAction("and stop ooh", delegate { var e = eventCaller.currentEntity; DJSchool.instance.AndStop(e.beat, e.toggle); }, 2.5f, false, new List<Param>()
{
new Param("toggle", true, "Ooh", "Whether or not the \"ooh\" sound should be played")
@ -25,6 +29,14 @@ namespace HeavenStudio.Games.Loaders
{
new Param("type", DJSchool.DJVoice.Standard, "Voice", "The voice line to play"),
}),
new GameAction("dj voice lines", delegate { DJSchool.instance.voiceLines(eventCaller.currentEntity.beat, eventCaller.currentEntity.type); }, 2f, false, new List<Param>()
{
new Param("type", DJSchool.DJVoiceLines.CheckItOut, "Voice Lines", "The voice line to play"),
}),
new GameAction("sound FX", delegate { DJSchool.instance.soundFX(eventCaller.currentEntity.toggle); }, .5f, false, new List<Param>()
{
new Param("toggle", false, "Radio FX", "Toggle on and off for Radio Effects")
})
},
new List<string>() {"ntr", "normal"},
"ntrdj", "en",
@ -47,16 +59,31 @@ namespace HeavenStudio.Games
Hyped
}
public enum DJVoiceLines
{
CheckItOut,
LetsGo,
OhYeah,
OhYeahAlt,
Yay
}
[Header("Components")]
[SerializeField] private Student student;
[SerializeField] private GameObject djYellow;
private Animator djYellowAnim;
[SerializeField] private SpriteRenderer headSprite;
[SerializeField] private Sprite[] headSprites;
private float lastReportedBeat = 0f;
[Header("Properties")]
public GameEvent bop = new GameEvent();
private bool djYellowHolding;
public bool andStop;
public bool goBop;
public float beatOfInstance;
public static DJSchool instance { get; private set; }
@ -65,53 +92,117 @@ namespace HeavenStudio.Games
instance = this;
djYellowAnim = djYellow.GetComponent<Animator>();
student.Init();
goBop = true;
}
private void Update()
{
var cond = Conductor.instance;
#region old script
//var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
//if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
//{
// if (cond.songPositionInBeats >= bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length)
// {
// if (student.anim.IsAnimationNotPlaying())
// {
// if (student.isHolding)
// {
// student.anim.Play("HoldBop", 0, 0);
// }
// else
// {
// student.anim.Play("IdleBop", 0, 0);
// }
// }
// if (djYellowAnim.IsAnimationNotPlaying())
// {
// var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
// if (yellowState.IsName("Hey"))
// {
// PostScratchoFace();
// }
// if (djYellowHolding)
// {
// djYellowAnim.Play("HoldBop", 0, 0);
// }
// else
// {
// // todo: split between left and right bop based on beat
// djYellowAnim.Play("IdleBop", 0, 0);
// }
// }
// }
//}
#endregion
if (Conductor.instance.ReportBeat(ref lastReportedBeat))
{
if (cond.songPositionInBeats >= bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length)
if (goBop)
{
if (student.anim.IsAnimationNotPlaying())
if (student.isHolding)
{
if (student.isHolding)
{
student.anim.Play("HoldBop", 0, 0);
}
else
{
student.anim.Play("IdleBop", 0, 0);
}
student.anim.Play("HoldBop", 0, 0);
}
if (djYellowAnim.IsAnimationNotPlaying())
else if (!student.swiping && student.anim.IsAnimationNotPlaying())
{
var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
if (yellowState.IsName("Hey"))
{
PostScratchoFace();
}
student.anim.Play("IdleBop", 0, 0);
}
if (djYellowHolding)
{
djYellowAnim.Play("HoldBop", 0, 0);
}
else
{
// todo: split between left and right bop based on beat
djYellowAnim.Play("IdleBop", 0, 0);
}
var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0);
if (yellowState.IsName("Hey"))
{
PostScratchoFace();
}
if (!andStop && !djYellowHolding)
{
djYellowAnim.Play("IdleBop", 0, 0);
}
else if (djYellowHolding)
{
djYellowAnim.Play("HoldBop", 0, 0);
}
}
}
else if (Conductor.instance.songPositionInBeats < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
}
if(PlayerInput.Pressed() && !IsExpectingInputNow() && !student.isHolding) //Start hold miss
{
student.OnMissHoldForPlayerInput();
student.isHolding = true;
}
else if(PlayerInput.PressedUp() && !IsExpectingInputNow() && student.isHolding) //Let go during hold
{
student.UnHold();
}
//else if(PlayerInput.PressedUp() && !IsExpectingInputNow() && !student.isHolding)
//{
// student.OnMissSwipeForPlayerInput();
//}
}
public void Bop(float beat, float length)
//public void Bop(float beat, float length)
//{
// bop.startBeat = beat;
// bop.length = length;
//}
public void Bop(bool isBopping)
{
bop.startBeat = beat;
bop.length = length;
if (isBopping)
{
goBop = true;
}
else
{
goBop = false;
}
}
public void BreakCmon(float beat, int type, bool ooh)
@ -148,19 +239,20 @@ namespace HeavenStudio.Games
BeatAction.New(djYellow, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); SetupCue(beat, false); }),
new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); }),
new BeatAction.Action(beat + 2f, delegate
{
djYellow.GetComponent<Animator>().Play("Hold", 0, 0);
djYellowHolding = true;
}),
});
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty);
}
public void AndStop(float beat, bool ooh)
{
if (djYellowHolding) return;
var sound = new MultiSound.Sound[]
{
new MultiSound.Sound("djSchool/andStop1", beat),
@ -175,13 +267,16 @@ namespace HeavenStudio.Games
BeatAction.New(djYellow, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 0.5f, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); SetupCue(beat - 0.5f, false); }),
new BeatAction.Action(beat + 0.5f, delegate { djYellow.GetComponent<Animator>().Play("BreakCmon", 0, 0); }),
new BeatAction.Action(beat + 1.5f, delegate
{
djYellow.GetComponent<Animator>().Play("Hold", 0, 0);
djYellowHolding = true;
}),
});
andStop = true;
ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty);
}
public void ScratchoHey(float beat, int type)
@ -213,25 +308,34 @@ namespace HeavenStudio.Games
BeatAction.New(djYellow, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { djYellow.GetComponent<Animator>().Play("Scratcho", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("Scratcho2", 0, 0); SetupCue(beat, true); }),
new BeatAction.Action(beat + .5f, delegate { djYellow.GetComponent<Animator>().Play("Scratcho2", 0, 0); }),
//new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("Scratcho", 0, 0); SetupCue(beat, true); }),
new BeatAction.Action(beat + 1f, delegate { djYellow.GetComponent<Animator>().Play("Scratcho", 0, 0); }),
new BeatAction.Action(beat + 2.05f, delegate
{
djYellow.GetComponent<Animator>().Play("Hey", 0, 0);
djYellowHolding = false;
}),
});
beatOfInstance = beat;
ScheduleInput(beat, 2f, InputType.STANDARD_UP, student.OnHitSwipe, student.OnMissSwipe, student.OnEmpty);
andStop = false;
}
void SetupCue(float beat, bool swipe)
{
if (swipe)
student.swipeBeat = beat;
else
student.holdBeat = beat;
//void SetupCue(float beat, bool swipe)
//{
// if (swipe)
// student.swipeBeat = beat;
// else
// student.holdBeat = beat;
student.eligible = true;
student.ResetState();
}
// student.eligible = true;
// student.ResetState();
//}
public void SetDJYellowHead(int type, bool resetAfterBeats = false)
{
@ -268,5 +372,67 @@ namespace HeavenStudio.Games
SetDJYellowHead(2, true);
}
}
public void soundFX(bool toggle)
{
student.soundFX = toggle;
}
public void voiceLines(float beat, int type)
{
string[] sounds;
var sound = new MultiSound.Sound[] { };
switch (type)
{
case 0:
sounds = new string[] { "djSchool/checkItOut1", "djSchool/checkItOut2", "djSchool/checkItOut3" };
sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .25f),
new MultiSound.Sound(sounds[2], beat + .5f),
};
MultiSound.Play(sound);
break;
case 1:
sounds = new string[] { "djSchool/letsGo1", "djSchool/letsGo2" };
sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .5f),
};
MultiSound.Play(sound);
break;
case 2:
sounds = new string[] { "djSchool/ohYeah1", "djSchool/ohYeah2" };
sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .5f),
};
MultiSound.Play(sound);
break;
case 3:
sounds = new string[] { "djSchool/ohYeahAlt1", "djSchool/ohYeahAlt2", "djSchool/ohYeahAlt3" };
sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .5f),
new MultiSound.Sound(sounds[2], beat + 1f),
};
MultiSound.Play(sound);
break;
case 4:
Jukebox.PlayOneShotGame("djSchool/yay");
break;
}
}
}
}