Browse Source

Renamed CameraController to CameraManager and MusicController to MusicManager

master
Christopher 8 years ago
parent
commit
9aaa2de464
  1. 8
      Assets/Fungus/Scripts/Commands/FadeScreen.cs
  2. 12
      Assets/Fungus/Scripts/Commands/FadeToView.cs
  3. 8
      Assets/Fungus/Scripts/Commands/MoveToView.cs
  4. 4
      Assets/Fungus/Scripts/Commands/PlayMusic.cs
  5. 4
      Assets/Fungus/Scripts/Commands/PlaySound.cs
  6. 4
      Assets/Fungus/Scripts/Commands/SetAudioPitch.cs
  7. 4
      Assets/Fungus/Scripts/Commands/SetAudioVolume.cs
  8. 4
      Assets/Fungus/Scripts/Commands/StartSwipe.cs
  9. 4
      Assets/Fungus/Scripts/Commands/StopMusic.cs
  10. 4
      Assets/Fungus/Scripts/Commands/StopSwipe.cs
  11. 4
      Assets/Fungus/Scripts/Components/CameraManager.cs
  12. 0
      Assets/Fungus/Scripts/Components/CameraManager.cs.meta
  13. 12
      Assets/Fungus/Scripts/Components/FungusManager.cs
  14. 4
      Assets/Fungus/Scripts/Components/MusicManager.cs
  15. 0
      Assets/Fungus/Scripts/Components/MusicManager.cs.meta
  16. 10
      Assets/Fungus/Scripts/Components/Writer.cs

8
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();

12
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()

8
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()

4
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();
}

4
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)
{

4
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)
{

4
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();

4
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()

4
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();
}

4
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();
}

4
Assets/Fungus/Scripts/Components/CameraController.cs → Assets/Fungus/Scripts/Components/CameraManager.cs

@ -10,9 +10,9 @@ using Fungus;
namespace Fungus
{
/// <summary>
/// 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.
/// </summary>
public class CameraController : MonoBehaviour
public class CameraManager : MonoBehaviour
{
[Tooltip("Full screen texture used for screen fade effect.")]
[SerializeField] protected Texture2D screenFadeTexture;

0
Assets/Fungus/Scripts/Components/CameraController.cs.meta → Assets/Fungus/Scripts/Components/CameraManager.cs.meta

12
Assets/Fungus/Scripts/Components/FungusManager.cs

@ -6,8 +6,8 @@ namespace Fungus
/// <summary>
/// Fungus manager singleton. Manages access to all Fungus singletons in a consistent manner.
/// </summary>
[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<CameraController>();
Music = GetComponent<MusicController>();
CameraManager = GetComponent<CameraManager>();
MusicManager = GetComponent<MusicManager>();
}
/// <summary>
@ -38,12 +38,12 @@ namespace Fungus
/// <summary>
/// Gets the camera manager singleton instance.
/// </summary>
public CameraController Camera { get; private set; }
public CameraManager CameraManager { get; private set; }
/// <summary>
/// Gets the music manager singleton instance.
/// </summary>
public MusicController Music { get; private set; }
public MusicManager MusicManager { get; private set; }
/// <summary>
/// Gets the FungusManager singleton instance.

4
Assets/Fungus/Scripts/Components/MusicController.cs → Assets/Fungus/Scripts/Components/MusicManager.cs

@ -10,7 +10,7 @@ namespace Fungus
/// Music playback persists across scene loads.
/// </summary>
[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;

0
Assets/Fungus/Scripts/Components/MusicController.cs.meta → Assets/Fungus/Scripts/Components/MusicManager.cs.meta

10
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);
});
}

Loading…
Cancel
Save