HeavenStudio/Assets/Scripts/Games/SoundEffects.cs
minenice55 caf7d9465f
Play Mode Features Part 1 (#413)
* add pause menu assets

* layout and animation for pause

* make play mode prefab function

re-assign unused class inheritance

* remove filepath

* don't init medals twice

* remove PlayerActionObject

* initial attempt at anti-note lock

TODO: circumvent inputs clearing themselves making the functionality not work

* properly implement input lock prevention

* fix error on editor open

* functional pause menu

* bugfix

* make unpausing not reset current play statistics

* serialize initializer components in inspector instead of procedurally generating

* sanity check

* note for fade

* make flashes in the camera prefabs instead of in world space

remove / reorganize script files
address issue #411

* fix bug with perfect campaign

make minigame transitions hide the game canvas
adjust animation of the song credits textbox

* fully functional intro scene (placeholder for future title screen)

refactored entire game loading procedure
re-organized some files

* add interaction query to disclaimer text

* reword legal

* anchor section medals to section display

more tempo change placement controls

* operation order bugfix

* prep for future ratings and stats

* loading text

* autoload opening scene

* splash screen adjustments

added setting to force enable splash screen

* adjust setting entry
2023-05-07 20:33:15 +00:00

104 lines
3.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games
{
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);
}
}
}