mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-23 18:15:13 +00:00
Gave sound objects a little more functionality
This commit is contained in:
parent
c4b2ea97fd
commit
2d328229c9
2 changed files with 16 additions and 3 deletions
|
@ -25,7 +25,7 @@ namespace RhythmHeavenMania.Util
|
|||
}
|
||||
|
||||
|
||||
public static void Play(Sound[] snds, bool game = true)
|
||||
public static MultiSound Play(Sound[] snds, bool game = true)
|
||||
{
|
||||
List<Sound> sounds = snds.ToList();
|
||||
GameObject gameObj = new GameObject();
|
||||
|
@ -36,6 +36,7 @@ namespace RhythmHeavenMania.Util
|
|||
gameObj.name = "MultiSound";
|
||||
|
||||
GameManager.instance.SoundObjects.Add(gameObj);
|
||||
return ms;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
@ -57,8 +58,14 @@ namespace RhythmHeavenMania.Util
|
|||
|
||||
if (songPositionInBeats >= (sounds[sounds.Count - 1].beat))
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
GameManager.instance.SoundObjects.Remove(gameObject);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -70,7 +70,13 @@ namespace RhythmHeavenMania.Util
|
|||
IEnumerator NotRelyOnBeatSound()
|
||||
{
|
||||
yield return new WaitForSeconds(clip.length);
|
||||
Destroy(this.gameObject);
|
||||
Delete();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
GameManager.instance.SoundObjects.Remove(gameObject);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue