diff --git a/Assets/Fungus/Scripts/Commands/FadeScreen.cs b/Assets/Fungus/Scripts/Commands/FadeScreen.cs index b44c35fd..d8300d4b 100644 --- a/Assets/Fungus/Scripts/Commands/FadeScreen.cs +++ b/Assets/Fungus/Scripts/Commands/FadeScreen.cs @@ -35,18 +35,18 @@ namespace Fungus.Commands public override void OnEnter() { - var cameraController = FungusManager.Instance.Camera; + var cameraManager = FungusManager.Instance.CameraManager; if (fadeTexture) { - cameraController.ScreenFadeTexture = fadeTexture; + cameraManager.ScreenFadeTexture = fadeTexture; } else { - cameraController.ScreenFadeTexture = CameraController.CreateColorTexture(fadeColor, 32, 32); + cameraManager.ScreenFadeTexture = CameraManager.CreateColorTexture(fadeColor, 32, 32); } - cameraController.Fade(targetAlpha, duration, delegate { + cameraManager.Fade(targetAlpha, duration, delegate { if (waitUntilFinished) { Continue(); diff --git a/Assets/Fungus/Scripts/Commands/FadeToView.cs b/Assets/Fungus/Scripts/Commands/FadeToView.cs index a9363863..169895fe 100644 --- a/Assets/Fungus/Scripts/Commands/FadeToView.cs +++ b/Assets/Fungus/Scripts/Commands/FadeToView.cs @@ -71,18 +71,18 @@ namespace Fungus.Commands return; } - var cameraController = FungusManager.Instance.Camera; + var cameraManager = FungusManager.Instance.CameraManager; if (fadeTexture) { - cameraController.ScreenFadeTexture = fadeTexture; + cameraManager.ScreenFadeTexture = fadeTexture; } else { - cameraController.ScreenFadeTexture = CameraController.CreateColorTexture(fadeColor, 32, 32); + cameraManager.ScreenFadeTexture = CameraManager.CreateColorTexture(fadeColor, 32, 32); } - cameraController.FadeToView(targetCamera, targetView, duration, fadeOut, delegate { + cameraManager.FadeToView(targetCamera, targetView, duration, fadeOut, delegate { if (waitUntilFinished) { Continue(); @@ -97,9 +97,9 @@ namespace Fungus.Commands public override void OnStopExecuting() { - var cameraController = FungusManager.Instance.Camera; + var cameraManager = FungusManager.Instance.CameraManager; - cameraController.Stop(); + cameraManager.Stop(); } public override string GetSummary() diff --git a/Assets/Fungus/Scripts/Commands/MoveToView.cs b/Assets/Fungus/Scripts/Commands/MoveToView.cs index 3521a9cb..49aca8b5 100644 --- a/Assets/Fungus/Scripts/Commands/MoveToView.cs +++ b/Assets/Fungus/Scripts/Commands/MoveToView.cs @@ -58,13 +58,13 @@ namespace Fungus.Commands return; } - var cameraController = FungusManager.Instance.Camera; + var cameraManager = FungusManager.Instance.CameraManager; Vector3 targetPosition = targetView.transform.position; Quaternion targetRotation = targetView.transform.rotation; float targetSize = targetView.ViewSize; - cameraController.PanToPosition(targetCamera, targetPosition, targetRotation, targetSize, duration, delegate { + cameraManager.PanToPosition(targetCamera, targetPosition, targetRotation, targetSize, duration, delegate { if (waitUntilFinished) { Continue(); @@ -79,9 +79,9 @@ namespace Fungus.Commands public override void OnStopExecuting() { - var cameraController = FungusManager.Instance.Camera; + var cameraManager = FungusManager.Instance.CameraManager; - cameraController.Stop(); + cameraManager.Stop(); } public override string GetSummary() diff --git a/Assets/Fungus/Scripts/Commands/PlayMusic.cs b/Assets/Fungus/Scripts/Commands/PlayMusic.cs index 69aab315..ddd3bbda 100644 --- a/Assets/Fungus/Scripts/Commands/PlayMusic.cs +++ b/Assets/Fungus/Scripts/Commands/PlayMusic.cs @@ -30,10 +30,10 @@ namespace Fungus.Commands public override void OnEnter() { - var musicController = FungusManager.Instance.Music; + var musicManager = FungusManager.Instance.MusicManager; float startTime = Mathf.Max(0, atTime); - musicController.PlayMusic(musicClip, loop, fadeDuration, startTime); + musicManager.PlayMusic(musicClip, loop, fadeDuration, startTime); Continue(); } diff --git a/Assets/Fungus/Scripts/Commands/PlaySound.cs b/Assets/Fungus/Scripts/Commands/PlaySound.cs index ad6c9446..b929bb2a 100644 --- a/Assets/Fungus/Scripts/Commands/PlaySound.cs +++ b/Assets/Fungus/Scripts/Commands/PlaySound.cs @@ -39,9 +39,9 @@ namespace Fungus.Commands return; } - var musicController = FungusManager.Instance.Music; + var musicManager = FungusManager.Instance.MusicManager; - musicController.PlaySound(soundClip, volume); + musicManager.PlaySound(soundClip, volume); if (waitUntilFinished) { diff --git a/Assets/Fungus/Scripts/Commands/SetAudioPitch.cs b/Assets/Fungus/Scripts/Commands/SetAudioPitch.cs index 242fe901..1052a86e 100644 --- a/Assets/Fungus/Scripts/Commands/SetAudioPitch.cs +++ b/Assets/Fungus/Scripts/Commands/SetAudioPitch.cs @@ -36,9 +36,9 @@ namespace Fungus.Commands } }; - var musicController = FungusManager.Instance.Music; + var musicManager = FungusManager.Instance.MusicManager; - musicController.SetAudioPitch(pitch, fadeDuration, onComplete); + musicManager.SetAudioPitch(pitch, fadeDuration, onComplete); if (!waitUntilFinished) { diff --git a/Assets/Fungus/Scripts/Commands/SetAudioVolume.cs b/Assets/Fungus/Scripts/Commands/SetAudioVolume.cs index 9e4f3b9a..e36c975b 100644 --- a/Assets/Fungus/Scripts/Commands/SetAudioVolume.cs +++ b/Assets/Fungus/Scripts/Commands/SetAudioVolume.cs @@ -29,9 +29,9 @@ namespace Fungus.Commands public override void OnEnter() { - var musicController = FungusManager.Instance.Music; + var musicManager = FungusManager.Instance.MusicManager; - musicController.SetAudioVolume(volume, fadeDuration, () => { + musicManager.SetAudioVolume(volume, fadeDuration, () => { if (waitUntilFinished) { Continue(); diff --git a/Assets/Fungus/Scripts/Commands/StartSwipe.cs b/Assets/Fungus/Scripts/Commands/StartSwipe.cs index b6b12e63..3f775d8d 100644 --- a/Assets/Fungus/Scripts/Commands/StartSwipe.cs +++ b/Assets/Fungus/Scripts/Commands/StartSwipe.cs @@ -53,9 +53,9 @@ namespace Fungus.Commands return; } - var cameraController = FungusManager.Instance.Camera; + var cameraManager = FungusManager.Instance.CameraManager; - cameraController.StartSwipePan(targetCamera, viewA, viewB, duration, speedMultiplier, () => Continue() ); + cameraManager.StartSwipePan(targetCamera, viewA, viewB, duration, speedMultiplier, () => Continue() ); } public override string GetSummary() diff --git a/Assets/Fungus/Scripts/Commands/StopMusic.cs b/Assets/Fungus/Scripts/Commands/StopMusic.cs index 9573721b..59e8d9d8 100644 --- a/Assets/Fungus/Scripts/Commands/StopMusic.cs +++ b/Assets/Fungus/Scripts/Commands/StopMusic.cs @@ -18,9 +18,9 @@ namespace Fungus.Commands public override void OnEnter() { - var musicController = FungusManager.Instance.Music; + var musicManager = FungusManager.Instance.MusicManager; - musicController.StopMusic(); + musicManager.StopMusic(); Continue(); } diff --git a/Assets/Fungus/Scripts/Commands/StopSwipe.cs b/Assets/Fungus/Scripts/Commands/StopSwipe.cs index 88205e19..e947d751 100644 --- a/Assets/Fungus/Scripts/Commands/StopSwipe.cs +++ b/Assets/Fungus/Scripts/Commands/StopSwipe.cs @@ -18,9 +18,9 @@ namespace Fungus.Commands public override void OnEnter() { - var cameraController = FungusManager.Instance.Camera; + var cameraManager = FungusManager.Instance.CameraManager; - cameraController.StopSwipePan(); + cameraManager.StopSwipePan(); Continue(); } diff --git a/Assets/Fungus/Scripts/Components/CameraController.cs b/Assets/Fungus/Scripts/Components/CameraManager.cs similarity index 99% rename from Assets/Fungus/Scripts/Components/CameraController.cs rename to Assets/Fungus/Scripts/Components/CameraManager.cs index 3bb4c6d0..a8bb4751 100644 --- a/Assets/Fungus/Scripts/Components/CameraController.cs +++ b/Assets/Fungus/Scripts/Components/CameraManager.cs @@ -10,9 +10,9 @@ using Fungus; namespace Fungus { /// - /// Controller for main camera.Supports several types of camera transition including snap, pan & fade. + /// Manager for main camera. Supports several types of camera transition including snap, pan & fade. /// - public class CameraController : MonoBehaviour + public class CameraManager : MonoBehaviour { [Tooltip("Full screen texture used for screen fade effect.")] [SerializeField] protected Texture2D screenFadeTexture; diff --git a/Assets/Fungus/Scripts/Components/CameraController.cs.meta b/Assets/Fungus/Scripts/Components/CameraManager.cs.meta similarity index 100% rename from Assets/Fungus/Scripts/Components/CameraController.cs.meta rename to Assets/Fungus/Scripts/Components/CameraManager.cs.meta diff --git a/Assets/Fungus/Scripts/Components/FungusManager.cs b/Assets/Fungus/Scripts/Components/FungusManager.cs index fb068120..65bc0cad 100644 --- a/Assets/Fungus/Scripts/Components/FungusManager.cs +++ b/Assets/Fungus/Scripts/Components/FungusManager.cs @@ -6,8 +6,8 @@ namespace Fungus /// /// Fungus manager singleton. Manages access to all Fungus singletons in a consistent manner. /// - [RequireComponent(typeof(CameraController))] - [RequireComponent(typeof(MusicController))] + [RequireComponent(typeof(CameraManager))] + [RequireComponent(typeof(MusicManager))] public sealed class FungusManager : MonoBehaviour { static FungusManager instance; @@ -16,8 +16,8 @@ namespace Fungus void Awake() { - Camera = GetComponent(); - Music = GetComponent(); + CameraManager = GetComponent(); + MusicManager = GetComponent(); } /// @@ -38,12 +38,12 @@ namespace Fungus /// /// Gets the camera manager singleton instance. /// - public CameraController Camera { get; private set; } + public CameraManager CameraManager { get; private set; } /// /// Gets the music manager singleton instance. /// - public MusicController Music { get; private set; } + public MusicManager MusicManager { get; private set; } /// /// Gets the FungusManager singleton instance. diff --git a/Assets/Fungus/Scripts/Components/MusicController.cs b/Assets/Fungus/Scripts/Components/MusicManager.cs similarity index 98% rename from Assets/Fungus/Scripts/Components/MusicController.cs rename to Assets/Fungus/Scripts/Components/MusicManager.cs index 5bcb89b6..2337870b 100644 --- a/Assets/Fungus/Scripts/Components/MusicController.cs +++ b/Assets/Fungus/Scripts/Components/MusicManager.cs @@ -10,7 +10,7 @@ namespace Fungus /// Music playback persists across scene loads. /// [RequireComponent(typeof(AudioSource))] - public class MusicController : MonoBehaviour + public class MusicManager : MonoBehaviour { protected virtual void Start() { @@ -32,7 +32,7 @@ namespace Fungus return; } - if (fadeDuration == 0f) + if (Mathf.Approximately(fadeDuration, 0f)) { audioSource.clip = musicClip; audioSource.loop = loop; diff --git a/Assets/Fungus/Scripts/Components/MusicController.cs.meta b/Assets/Fungus/Scripts/Components/MusicManager.cs.meta similarity index 100% rename from Assets/Fungus/Scripts/Components/MusicController.cs.meta rename to Assets/Fungus/Scripts/Components/MusicManager.cs.meta diff --git a/Assets/Fungus/Scripts/Components/Writer.cs b/Assets/Fungus/Scripts/Components/Writer.cs index 905a128a..e26baba2 100644 --- a/Assets/Fungus/Scripts/Components/Writer.cs +++ b/Assets/Fungus/Scripts/Components/Writer.cs @@ -665,12 +665,12 @@ namespace Fungus protected virtual void Flash(float duration) { - var cameraController = FungusManager.Instance.Camera; + var cameraManager = FungusManager.Instance.CameraManager; - cameraController.ScreenFadeTexture = CameraController.CreateColorTexture(new Color(1f,1f,1f,1f), 32, 32); - cameraController.Fade(1f, duration, delegate { - cameraController.ScreenFadeTexture = CameraController.CreateColorTexture(new Color(1f,1f,1f,1f), 32, 32); - cameraController.Fade(0f, duration, null); + cameraManager.ScreenFadeTexture = CameraManager.CreateColorTexture(new Color(1f,1f,1f,1f), 32, 32); + cameraManager.Fade(1f, duration, delegate { + cameraManager.ScreenFadeTexture = CameraManager.CreateColorTexture(new Color(1f,1f,1f,1f), 32, 32); + cameraManager.Fade(0f, duration, null); }); }