Merge pull request #45 from CarsonKompon/fix-sfx-cleanup

SFX Cleanup (Mr. Upbeat and Drumming Practice)
This commit is contained in:
Jenny Crowe 2022-03-08 17:12:21 -07:00 committed by GitHub
commit a90d7fc833
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 15 deletions

Binary file not shown.

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0a36856eb4188e9448f3daeb02632748
guid: c86bb199b366fb345b66a429c88e7bbf
AudioImporter:
externalObjects: {}
serializedVersion: 6

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 9a2262c26722c574bb3f347bdb19f534
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

@ -33,7 +33,7 @@ namespace RhythmHeavenMania.Games.DrummingPractice
{
if (player && PlayerInput.Pressed())
{
Hit(false);
Hit(false, false);
}
}
@ -57,8 +57,16 @@ namespace RhythmHeavenMania.Games.DrummingPractice
animator.Play("PrepareRight", 0, 0);
}
public void Hit(bool hit)
public void Hit(bool hit, bool applause, bool force = false)
{
if(player && force)
{
if (hit)
HitSound(applause);
else
MissSound();
}
if (!hitting)
{
if (count % 2 == 0)
@ -67,18 +75,29 @@ namespace RhythmHeavenMania.Games.DrummingPractice
animator.Play("HitRight", 0, 0);
count++;
if (player)
if (player && !force)
{
if (hit)
Jukebox.PlayOneShotGame("drummingPractice/hit");
HitSound(applause);
else
Jukebox.PlayOneShotGame("drummingPractice/miss");
MissSound();
}
hitting = true;
}
}
private void HitSound(bool applause)
{
Jukebox.PlayOneShotGame("drummingPractice/hit");
if (applause) Jukebox.PlayOneShot("applause");
}
private void MissSound()
{
Jukebox.PlayOneShotGame("drummingPractice/miss");
}
public void EndHit()
{
hitting = false;

View file

@ -9,6 +9,7 @@ namespace RhythmHeavenMania.Games.DrummingPractice
public class DrummerHit : PlayerActionObject
{
public float startBeat;
public bool applause = true;
private bool hit = false;
private bool hasHit = false;
@ -35,8 +36,8 @@ namespace RhythmHeavenMania.Games.DrummingPractice
if (!hit && Conductor.instance.GetPositionFromBeat(startBeat, 1) >= 1)
{
Jukebox.PlayOneShotGame("drummingPractice/drum");
DrummingPractice.instance.leftDrummer.Hit(true);
DrummingPractice.instance.rightDrummer.Hit(true);
DrummingPractice.instance.leftDrummer.Hit(true, false);
DrummingPractice.instance.rightDrummer.Hit(true, false);
hit = true;
if (hasHit) CleanUp();
}
@ -60,7 +61,7 @@ namespace RhythmHeavenMania.Games.DrummingPractice
{
if (!hasHit)
{
DrummingPractice.instance.player.Hit(_hit);
DrummingPractice.instance.player.Hit(_hit, applause, true);
DrummingPractice.instance.SetFaces(_hit ? 1 : 2);
hasHit = true;

View file

@ -70,7 +70,7 @@ namespace RhythmHeavenMania.Games.DrummingPractice
rightDrummer.Bop();
}
public void Prepare(float beat)
public void Prepare(float beat, bool applause)
{
int type = count % 2;
player.Prepare(type);
@ -86,6 +86,7 @@ namespace RhythmHeavenMania.Games.DrummingPractice
hit.SetActive(true);
DrummerHit h = hit.GetComponent<DrummerHit>();
h.startBeat = beat;
h.applause = applause;
}
public void SetFaces(int type)

View file

@ -84,10 +84,9 @@ namespace RhythmHeavenMania.Games.MrUpbeat
public void Ding(bool applause)
{
if(applause)
Jukebox.PlayOneShotGame("mrUpbeat/applause");
else
Jukebox.PlayOneShotGame("mrUpbeat/ding");
Jukebox.PlayOneShotGame("mrUpbeat/ding");
if (applause)
Jukebox.PlayOneShot("applause");
}
public void Beat(float beat)

View file

@ -391,7 +391,10 @@ namespace RhythmHeavenMania
new Minigame("drummingPractice", "Drumming Practice", "2BCF33", false, false, new List<GameAction>()
{
new GameAction("bop", delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.SetBop(e.beat, e.length); }, 0.5f, true),
new GameAction("drum", delegate { DrummingPractice.instance.Prepare(eventCaller.currentEntity.beat); }, 2f),
new GameAction("drum", delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.Prepare(e.beat, e.toggle); }, 2f, parameters: new List<Param>()
{
new Param("toggle", true, "Applause", "Whether or not an applause should be played on a successful hit")
}),
new GameAction("set mii", delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.SetMiis(e.type, e.toggle); }, 0.5f, parameters: new List<Param>()
{
new Param("type", DrummingPractice.MiiType.GuestA, "Mii", "The Mii that the player will control"),