chrisgregan
11 years ago
11 changed files with 214 additions and 33 deletions
@ -0,0 +1,34 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus.Script |
||||
{ |
||||
[CommandName("Play Music")] |
||||
[HelpText("Plays game music. If any game music is already playing, it is stopped. Music continues playing across scene loads.")] |
||||
public class PlayMusic : FungusCommand |
||||
{ |
||||
public AudioClip musicClip; |
||||
|
||||
public override void OnEnter() |
||||
{ |
||||
MusicController musicController = MusicController.GetInstance(); |
||||
if (musicController != null) |
||||
{ |
||||
musicController.PlayMusic(musicClip); |
||||
} |
||||
|
||||
Continue(); |
||||
} |
||||
|
||||
public override string GetSummary() |
||||
{ |
||||
if (musicClip == null) |
||||
{ |
||||
return "No music clip selected"; |
||||
} |
||||
|
||||
return musicClip.name; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 1902400ccc99b45d69ad01cb86b57d0f |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,37 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus.Script |
||||
{ |
||||
[CommandName("Play Sound")] |
||||
[HelpText("Plays a sound effect. Multiple sound effects can play at the same time.")] |
||||
public class PlaySound : FungusCommand |
||||
{ |
||||
public AudioClip soundClip; |
||||
|
||||
[Range(0,1)] |
||||
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) |
||||
{ |
||||
return "No sound clip selected"; |
||||
} |
||||
|
||||
return soundClip.name; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: bd2f6be51b3d7490ba5633ee095d0391 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,33 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus.Script |
||||
{ |
||||
[CommandName("Set Music Volume")] |
||||
[HelpText("Sets the game music volume level.")] |
||||
public class SetMusicVolume : FungusCommand |
||||
{ |
||||
[Range(0,1)] |
||||
public float volume = 1; |
||||
|
||||
[Range(0,30)] |
||||
public float fadeDuration; |
||||
|
||||
public override void OnEnter() |
||||
{ |
||||
MusicController musicController = MusicController.GetInstance(); |
||||
if (musicController != null) |
||||
{ |
||||
musicController.SetMusicVolume(volume, fadeDuration); |
||||
} |
||||
|
||||
Continue(); |
||||
} |
||||
|
||||
public override string GetSummary() |
||||
{ |
||||
return "Set to " + volume + " over " + fadeDuration + " seconds."; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: e5f62b7b5779c46aba13ef24141b2729 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,22 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus.Script |
||||
{ |
||||
[CommandName("Stop Music")] |
||||
[HelpText("Stops the currently playing game music.")] |
||||
public class StopMusic : FungusCommand |
||||
{ |
||||
public override void OnEnter() |
||||
{ |
||||
MusicController musicController = MusicController.GetInstance(); |
||||
if (musicController != null) |
||||
{ |
||||
musicController.StopMusic(); |
||||
} |
||||
|
||||
Continue(); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: b359b09a7ba2e4af981f07c07f8af85a |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
Loading…
Reference in new issue