Count-in Event Merge

LFG
This commit is contained in:
Carson Kompon 2022-03-01 14:21:23 -05:00
parent 1284e7ca1c
commit 36dd972a02
4 changed files with 146 additions and 83 deletions

View File

@ -9563,7 +9563,7 @@ MonoBehaviour:
gridGameSelector: {fileID: 1154875947}
IntegerP: {fileID: 396879232}
FloatP: {fileID: 345301789}
BooleanP: {fileID: 0}
BooleanP: {fileID: 755586977}
DropdownP: {fileID: 184838087}
ColorP: {fileID: 1443721746}
entity:

View File

@ -121,92 +121,40 @@ namespace RhythmHeavenMania
}),
new Minigame("countIn", "Count-Ins", "", false, true, new List<GameAction>()
{
new GameAction("4 beat count-in", delegate
new GameAction("4 beat count-in", delegate { var e = eventCaller.currentEntity; SoundEffects.FourBeatCountIn(e.beat, e.length / 4f, e.type); }, 4f, true, new List<Param>()
{
MultiSound.Play(new MultiSound.Sound[]
new Param("type", SoundEffects.CountInType.Normal, "Type")
}),
new GameAction("8 beat count-in", delegate { var e = eventCaller.currentEntity; SoundEffects.EightBeatCountIn(e.beat, e.length / 8f, e.type); }, 8f, true, new List<Param>()
{
new MultiSound.Sound("count-ins/one1", eventCaller.currentEntity.beat),
new MultiSound.Sound("count-ins/two1", eventCaller.currentEntity.beat + 1f),
new MultiSound.Sound("count-ins/three1", eventCaller.currentEntity.beat + 2f),
new MultiSound.Sound("count-ins/four1", eventCaller.currentEntity.beat + 3f)
}, false);
}, 4f),
new GameAction("4 beat count-in (alt)", delegate
new Param("type", SoundEffects.CountInType.Normal, "Type")
}),
new GameAction("count", delegate { var e = eventCaller.currentEntity; SoundEffects.Count(e.type, e.toggle); }, 1f, false, new List<Param>()
{
MultiSound.Play(new MultiSound.Sound[]
new Param("type", SoundEffects.CountNumbers.One, "Number"),
new Param("toggle", false, "Alt")
}),
new GameAction("cowbell", delegate { SoundEffects.Cowbell(); }, 1f),
new GameAction("ready!", delegate { var e = eventCaller.currentEntity; SoundEffects.Ready(e.beat, e.length / 2f); }, 2f, true),
new GameAction("and", delegate {SoundEffects.And(); }, 0.5f),
new GameAction("go!", delegate { SoundEffects.Go(eventCaller.currentEntity.toggle); }, 1f, false, new List<Param>()
{
new MultiSound.Sound("count-ins/one2", eventCaller.currentEntity.beat),
new MultiSound.Sound("count-ins/two2", eventCaller.currentEntity.beat + 1f),
new MultiSound.Sound("count-ins/three2", eventCaller.currentEntity.beat + 2f),
new MultiSound.Sound("count-ins/four2", eventCaller.currentEntity.beat + 3f)
}, false);
}, 4f),
new GameAction("4 beat count-in (cowbell)", delegate
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat),
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat + 1f),
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat + 2f),
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat + 3f)
}, false);
}, 4f),
new GameAction("8 beat count-in", delegate
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("count-ins/one1", eventCaller.currentEntity.beat),
new MultiSound.Sound("count-ins/two1", eventCaller.currentEntity.beat + 2f),
new MultiSound.Sound("count-ins/one1", eventCaller.currentEntity.beat + 4f),
new MultiSound.Sound("count-ins/two1", eventCaller.currentEntity.beat + 5f),
new MultiSound.Sound("count-ins/three1", eventCaller.currentEntity.beat + 6f),
new MultiSound.Sound("count-ins/four1", eventCaller.currentEntity.beat + 7f)
}, false);
}, 8f),
new GameAction("8 beat count-in (alt)", delegate
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("count-ins/one2", eventCaller.currentEntity.beat),
new MultiSound.Sound("count-ins/two2", eventCaller.currentEntity.beat + 2f),
new MultiSound.Sound("count-ins/one2", eventCaller.currentEntity.beat + 4f),
new MultiSound.Sound("count-ins/two2", eventCaller.currentEntity.beat + 5f),
new MultiSound.Sound("count-ins/three2", eventCaller.currentEntity.beat + 6f),
new MultiSound.Sound("count-ins/four2", eventCaller.currentEntity.beat + 7f)
}, false);
}, 8f),
new GameAction("8 beat count-in (cowbell)", delegate
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat),
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat + 2f),
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat + 4f),
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat + 5f),
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat + 6f),
new MultiSound.Sound("count-ins/cowbell", eventCaller.currentEntity.beat + 7f)
}, false);
}, 8f),
new GameAction("cowbell", delegate { Jukebox.PlayOneShot("count-ins/cowbell"); }, 1f),
new GameAction("one", delegate { Jukebox.PlayOneShot("count-ins/one1"); }, 1f),
new GameAction("one (alt)", delegate { Jukebox.PlayOneShot("count-ins/one2"); }, 1f),
new GameAction("two", delegate { Jukebox.PlayOneShot("count-ins/two1"); }, 1f),
new GameAction("two (alt)", delegate { Jukebox.PlayOneShot("count-ins/two2"); }, 1f),
new GameAction("three", delegate { Jukebox.PlayOneShot("count-ins/three1"); }, 1f),
new GameAction("three (alt)", delegate { Jukebox.PlayOneShot("count-ins/three2"); }, 1f),
new GameAction("four", delegate { Jukebox.PlayOneShot("count-ins/four1"); }, 1f),
new GameAction("four (alt)", delegate { Jukebox.PlayOneShot("count-ins/four2"); }, 1f),
new GameAction("and", delegate { Jukebox.PlayOneShot("count-ins/and"); }, 0.5f),
new GameAction("go!", delegate { Jukebox.PlayOneShot("count-ins/go1"); }, 1f),
new GameAction("go! (alt)", delegate { Jukebox.PlayOneShot("count-ins/go2"); }, 1f),
new GameAction("ready!", delegate
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("count-ins/ready1", eventCaller.currentEntity.beat),
new MultiSound.Sound("count-ins/ready2", eventCaller.currentEntity.beat + 1f),
}, false);
}, 2f),
new Param("toggle", false, "Alt")
}),
// These are still here for backwards-compatibility but are hidden in the editor
new GameAction("4 beat count-in (alt)", delegate { var e = eventCaller.currentEntity; SoundEffects.FourBeatCountIn(e.beat, e.length, 1); }, 4f, hidden: true),
new GameAction("4 beat count-in (cowbell)", delegate { var e = eventCaller.currentEntity; SoundEffects.FourBeatCountIn(e.beat, e.length, 2); }, 4f, hidden: true),
new GameAction("8 beat count-in (alt)", delegate { var e = eventCaller.currentEntity; SoundEffects.EightBeatCountIn(e.beat, e.length, 1); }, 4f, hidden: true),
new GameAction("8 beat count-in (cowbell)", delegate { var e = eventCaller.currentEntity; SoundEffects.EightBeatCountIn(e.beat, e.length, 2); }, 4f, hidden: true),
new GameAction("one", delegate { SoundEffects.Count(0, false); }, 1f, hidden: true),
new GameAction("one (alt)", delegate { SoundEffects.Count(0, true); }, 1f, hidden: true),
new GameAction("two", delegate { SoundEffects.Count(1, false); }, 1f, hidden: true),
new GameAction("two (alt)", delegate { SoundEffects.Count(1, true); }, 1f, hidden: true),
new GameAction("three", delegate { SoundEffects.Count(2, false); }, 1f, hidden: true),
new GameAction("three (alt)", delegate { SoundEffects.Count(2, true); }, 1f, hidden: true),
new GameAction("four", delegate { SoundEffects.Count(3, false); }, 1f, hidden: true),
new GameAction("four (alt)", delegate { SoundEffects.Count(3, true); }, 1f, hidden: true),
new GameAction("go! (alt)", delegate { SoundEffects.Go(true); }, 1f, hidden: true),
}),
new Minigame("forkLifter", "Fork Lifter", "FFFFFF", false, false, new List<GameAction>()
{

View File

@ -0,0 +1,104 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RhythmHeavenMania.Util;
namespace RhythmHeavenMania
{
public class SoundEffects : MonoBehaviour
{
public enum CountNumbers { One, Two, Three, Four }
public static string[] countNames = { "one", "two", "three", "four" };
public static void Count(int type, bool alt)
{
string sound = countNames[type];
if (!alt)
sound += "1";
else
sound += "2";
Jukebox.PlayOneShot("count-ins/" + sound);
}
public enum CountInType { Normal, Alt, Cowbell }
public static string[] GetCountInSounds(string[] sounds, CountInType type)
{
for (int i = 0; i < sounds.Length; i++)
{
switch (type)
{
case CountInType.Normal:
sounds[i] += "1";
break;
case CountInType.Alt:
sounds[i] += "2";
break;
case CountInType.Cowbell:
sounds[i] = "cowbell";
break;
}
}
return sounds;
}
public static void FourBeatCountIn(float beat, float length, int type)
{
string[] sounds = { "one", "two", "three", "four" };
sounds = GetCountInSounds(sounds, (CountInType)type);
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("count-ins/" + sounds[0], beat),
new MultiSound.Sound("count-ins/" + sounds[1], beat + 1f * length),
new MultiSound.Sound("count-ins/" + sounds[2], beat + 2f * length),
new MultiSound.Sound("count-ins/" + sounds[3], beat + 3f * length)
}, false);
}
public static void EightBeatCountIn(float beat, float length, int type)
{
string[] sounds = { "one", "two", "one", "two", "three", "four" };
sounds = GetCountInSounds(sounds, (CountInType)type);
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("count-ins/" + sounds[0], beat),
new MultiSound.Sound("count-ins/" + sounds[1], beat + 2f * length),
new MultiSound.Sound("count-ins/" + sounds[2], beat + 4f * length),
new MultiSound.Sound("count-ins/" + sounds[3], beat + 5f * length),
new MultiSound.Sound("count-ins/" + sounds[4], beat + 6f * length),
new MultiSound.Sound("count-ins/" + sounds[5], beat + 7f * length)
}, false);
}
public static void Cowbell()
{
Jukebox.PlayOneShot("count-ins/cowbell");
}
public static void Ready(float beat, float length)
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("count-ins/ready1", beat),
new MultiSound.Sound("count-ins/ready2", beat + 1f * length),
}, false);
}
public static void And()
{
Jukebox.PlayOneShot("count-ins/and");
}
public static void Go(bool alt)
{
string sound = "count-ins/go";
if (!alt)
sound += "1";
else
sound += "2";
Jukebox.PlayOneShot(sound);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c2f8829b764160148b6dbf3947ea9df3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: