You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
890 B
45 lines
890 B
10 years ago
|
using UnityEngine;
|
||
10 years ago
|
using System.Collections;
|
||
|
|
||
10 years ago
|
namespace Fungus
|
||
10 years ago
|
{
|
||
10 years ago
|
[CommandInfo("Audio",
|
||
|
"Play Sound",
|
||
10 years ago
|
"Plays a once-off sound effect. Multiple sound effects can be played at the same time.")]
|
||
10 years ago
|
public class PlaySound : Command
|
||
10 years ago
|
{
|
||
10 years ago
|
[Tooltip("Sound effect clip to play")]
|
||
10 years ago
|
public AudioClip soundClip;
|
||
|
|
||
|
[Range(0,1)]
|
||
10 years ago
|
[Tooltip("Volume level of the sound effect")]
|
||
10 years ago
|
public float volume = 1;
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
MusicController musicController = MusicController.GetInstance();
|
||
|
if (musicController != null)
|
||
|
{
|
||
|
musicController.PlaySound(soundClip, volume);
|
||
|
}
|
||
|
|
||
|
Continue();
|
||
|
}
|
||
|
|
||
|
public override string GetSummary()
|
||
|
{
|
||
|
if (soundClip == null)
|
||
|
{
|
||
10 years ago
|
return "Error: No music clip selected";
|
||
10 years ago
|
}
|
||
|
|
||
|
return soundClip.name;
|
||
|
}
|
||
10 years ago
|
|
||
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(242, 209, 176, 255);
|
||
|
}
|
||
10 years ago
|
}
|
||
|
|
||
|
}
|