DJ School extra sfx

This commit is contained in:
Braedon
2022-02-09 02:46:49 -05:00
parent fc71d1ec79
commit 6cfbb0e3f5
11 changed files with 1003 additions and 19 deletions

View File

@ -10,9 +10,13 @@ namespace RhythmHeavenMania.Games.DJSchool
[Header("Components")]
[SerializeField] private Student student;
[SerializeField] private GameObject djYellow;
private Animator djYellowAnim;
[SerializeField] private SpriteRenderer headSprite;
[SerializeField] private Sprite[] headSprites;
[Header("Properties")]
public GameEvent bop = new GameEvent();
private bool djYellowHolding;
public static DJSchool instance { get; private set; }
@ -21,6 +25,11 @@ namespace RhythmHeavenMania.Games.DJSchool
instance = this;
}
private void Start()
{
djYellowAnim = djYellow.GetComponent<Animator>();
}
private void Update()
{
if (Conductor.instance.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
@ -38,6 +47,18 @@ namespace RhythmHeavenMania.Games.DJSchool
student.anim.Play("IdleBop", 0, 0);
}
}
if (djYellowAnim.IsAnimationNotPlaying())
{
if (djYellowHolding)
{
djYellowAnim.Play("HoldBop", 0, 0);
}
else
{
// there is no sprite for the alternate idle bop, oh well
djYellowAnim.Play("IdleBop", 0, 0);
}
}
}
}
}
@ -48,44 +69,118 @@ namespace RhythmHeavenMania.Games.DJSchool
bop.length = length;
}
public void BreakCmon(float beat)
public void BreakCmon(float beat, int type)
{
if (djYellowHolding) return;
string[] sounds = new string[] { };
if (type == 0)
{
sounds = new string[] { "djSchool/breakCmon1", "djSchool/breakCmon2", "djSchool/ooh" };
}
else if (type == 1)
{
sounds = new string[] { "djSchool/breakCmonAlt1", "djSchool/breakCmonAlt2", "djSchool/oohAlt" };
}
else if (type == 2)
{
SetDJYellowHead(2);
sounds = new string[] { "djSchool/breakCmonLoud1", "djSchool/breakCmonLoud2", "djSchool/oohLoud" };
}
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("djSchool/breakCmon1", beat),
new MultiSound.Sound("djSchool/breakCmon2", beat + 1f),
new MultiSound.Sound("djSchool/ooh", beat + 2f),
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + 1f),
new MultiSound.Sound(sounds[2], beat + 2f),
});
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); }),
new BeatAction.Action(beat + 2f, delegate { djYellow.GetComponent<Animator>().Play("Hold", 0, 0); }),
new BeatAction.Action(beat + 2f, delegate
{
djYellow.GetComponent<Animator>().Play("Hold", 0, 0);
djYellowHolding = true;
SetDJYellowHead(1);
}),
});
student.holdBeat = beat;
student.ResetState();
}
public void ScratchoHey(float beat)
public void AndStop(float beat)
{
if (djYellowHolding) return;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("djSchool/scratchoHey1", beat),
new MultiSound.Sound("djSchool/scratchoHey2", beat + 1f),
new MultiSound.Sound("djSchool/hey", beat + 2f),
new MultiSound.Sound("djSchool/andStop1", beat),
new MultiSound.Sound("djSchool/andStop2", beat + 0.35f),
new MultiSound.Sound("djSchool/oohAlt", beat + 1.5f),
});
BeatAction.New(djYellow, new List<BeatAction.Action>()
{
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;
SetDJYellowHead(1);
}),
});
student.holdBeat = beat - 0.5f;
student.ResetState();
}
public void ScratchoHey(float beat, int type)
{
string[] sounds = new string[] { };
if (type == 0)
{
sounds = new string[] { "djSchool/scratchoHey1", "djSchool/scratchoHey2", "djSchool/hey" };
}
else if (type == 1)
{
sounds = new string[] { "djSchool/scratchoHeyAlt1", "djSchool/scratchoHeyAlt2", "djSchool/heyAlt" };
}
else if (type == 2)
{
sounds = new string[] { "djSchool/scratchoHeyLoud1", "djSchool/scratchoHeyLoud2", "djSchool/heyLoud" };
}
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + 1f),
new MultiSound.Sound(sounds[2], beat + 2f),
});
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); }),
new BeatAction.Action(beat + 2.05f, delegate { djYellow.GetComponent<Animator>().Play("Hey", 0, 0); }),
new BeatAction.Action(beat + 2.05f, delegate
{
djYellow.GetComponent<Animator>().Play("Hey", 0, 0);
djYellowHolding = false;
}),
});
student.swipeBeat = beat;
student.ResetState();
}
private void SetDJYellowHead(int type)
{
headSprite.sprite = headSprites[type];
}
}
}

View File

@ -184,13 +184,20 @@ namespace RhythmHeavenMania
new Minigame("djSchool", "DJ School \n<color=#eb5454>[Non-Playable]</color>", "008c97", false, false, new List<GameAction>()
{
new GameAction("bop", delegate { DJSchool.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true),
new GameAction("break c'mon ooh", delegate { DJSchool.instance.BreakCmon(eventCaller.currentEntity.beat); }, 3f),
new GameAction("scratch-o hey", delegate { DJSchool.instance.ScratchoHey(eventCaller.currentEntity.beat); }, 3f),
new GameAction("and stop ooh", delegate { DJSchool.instance.AndStop(eventCaller.currentEntity.beat); }, 2.5f),
new GameAction("break c'mon ooh", delegate { DJSchool.instance.BreakCmon(eventCaller.currentEntity.beat, eventCaller.currentEntity.type); }, 3f, false, new List<Param>()
{
new Param("type", new EntityTypes.Integer(0, 2, 0), "Type"),
}),
new GameAction("scratch-o hey", delegate { DJSchool.instance.ScratchoHey(eventCaller.currentEntity.beat, eventCaller.currentEntity.type); }, 3f, false, new List<Param>()
{
new Param("type", new EntityTypes.Integer(0, 2, 0), "Type"),
}),
}),
/*new Minigame("rhythmTweezers", "VeggieTales", "008c97", false, false, new List<GameAction>()
new Minigame("rhythmTweezers", "VeggieTales", "008c97", false, false, new List<GameAction>()
{
}),
new Minigame("rhythmRally", "Rhythm Rally", "B888F8", true, false, new List<GameAction>()
/*new Minigame("rhythmRally", "Rhythm Rally", "B888F8", true, false, new List<GameAction>()
{
}),