Browse Source

Fixed case typo in ControlAudio

master
Christopher 9 years ago
parent
commit
ef0dfaf987
  1. 4
      Assets/Fungus/Audio/Editor/ControlAudioEditor.cs
  2. 22
      Assets/Fungus/Audio/Scripts/Commands/ControlAudio.cs

4
Assets/Fungus/Audio/Editor/ControlAudioEditor.cs

@ -39,11 +39,11 @@ namespace Fungus
EditorGUILayout.PropertyField(controlProp); EditorGUILayout.PropertyField(controlProp);
EditorGUILayout.PropertyField(audioSourceProp); EditorGUILayout.PropertyField(audioSourceProp);
string fadeLabel = "Fade Out Duration"; string fadeLabel = "Fade Out Duration";
if (t.Control != ControlAudio.controlType.StopLoop && t.Control != ControlAudio.controlType.PauseLoop) if (t.Control != ControlAudio.ControlType.StopLoop && t.Control != ControlAudio.ControlType.PauseLoop)
{ {
fadeLabel = "Fade In Duration"; fadeLabel = "Fade In Duration";
string volumeLabel = "End Volume"; string volumeLabel = "End Volume";
if (t.Control == ControlAudio.controlType.ChangeVolume) if (t.Control == ControlAudio.ControlType.ChangeVolume)
{ {
fadeLabel = "Fade Duration"; fadeLabel = "Fade Duration";
volumeLabel = "New Volume"; volumeLabel = "New Volume";

22
Assets/Fungus/Audio/Scripts/Commands/ControlAudio.cs

@ -16,7 +16,7 @@ namespace Fungus
[ExecuteInEditMode] [ExecuteInEditMode]
public class ControlAudio : Command public class ControlAudio : Command
{ {
public enum controlType public enum ControlType
{ {
PlayOnce, PlayOnce,
PlayLoop, PlayLoop,
@ -26,8 +26,8 @@ namespace Fungus
} }
[Tooltip("What to do to audio")] [Tooltip("What to do to audio")]
[SerializeField] protected controlType control; [SerializeField] protected ControlType control;
public virtual controlType Control { get { return control; } } public virtual ControlType Control { get { return control; } }
[Tooltip("Audio clip to play")] [Tooltip("Audio clip to play")]
[SerializeField] protected AudioSourceData _audioSource; [SerializeField] protected AudioSourceData _audioSource;
@ -54,28 +54,28 @@ namespace Fungus
return; return;
} }
if (control != controlType.ChangeVolume) if (control != ControlType.ChangeVolume)
{ {
_audioSource.Value.volume = endVolume; _audioSource.Value.volume = endVolume;
} }
switch(control) switch(control)
{ {
case controlType.PlayOnce: case ControlType.PlayOnce:
StopAudioWithSameTag(); StopAudioWithSameTag();
PlayOnce(); PlayOnce();
break; break;
case controlType.PlayLoop: case ControlType.PlayLoop:
StopAudioWithSameTag(); StopAudioWithSameTag();
PlayLoop(); PlayLoop();
break; break;
case controlType.PauseLoop: case ControlType.PauseLoop:
PauseLoop(); PauseLoop();
break; break;
case controlType.StopLoop: case ControlType.StopLoop:
StopLoop(_audioSource.Value); StopLoop(_audioSource.Value);
break; break;
case controlType.ChangeVolume: case ControlType.ChangeVolume:
ChangeVolume(); ChangeVolume();
break; break;
} }
@ -255,11 +255,11 @@ namespace Fungus
if (fadeDuration > 0) if (fadeDuration > 0)
{ {
fadeType = " Fade out"; fadeType = " Fade out";
if (control != controlType.StopLoop) if (control != ControlType.StopLoop)
{ {
fadeType = " Fade in volume to " + endVolume; fadeType = " Fade in volume to " + endVolume;
} }
if (control == controlType.ChangeVolume) if (control == ControlType.ChangeVolume)
{ {
fadeType = " to " + endVolume; fadeType = " to " + endVolume;
} }

Loading…
Cancel
Save