Browse Source

Merge pull request #624 from iBicha/master

fixes #612
master
Chris Gregan 8 years ago committed by GitHub
parent
commit
fd7bb33315
  1. 19
      Assets/Fungus/Scripts/Components/CameraManager.cs

19
Assets/Fungus/Scripts/Components/CameraManager.cs

@ -42,6 +42,10 @@ namespace Fungus
protected View swipePanViewB; protected View swipePanViewB;
protected Vector3 previousMousePos; protected Vector3 previousMousePos;
//Coroutine handles for panning and fading commands
protected IEnumerator panCoroutine;
protected IEnumerator fadeCoroutine;
protected class CameraView protected class CameraView
{ {
public Vector3 cameraPos; public Vector3 cameraPos;
@ -331,8 +335,7 @@ namespace Fungus
view.ViewSize); view.ViewSize);
pathList.Add(viewPos); pathList.Add(viewPos);
} }
StartCoroutine(panCoroutine = PanToPathInternal (camera, duration, arriveAction, pathList.ToArray ()));
StartCoroutine(PanToPathInternal(camera, duration, arriveAction, pathList.ToArray()));
} }
/// <summary> /// <summary>
@ -363,7 +366,7 @@ namespace Fungus
/// </summary> /// </summary>
public virtual void Fade(float targetAlpha, float fadeDuration, Action fadeAction) public virtual void Fade(float targetAlpha, float fadeDuration, Action fadeAction)
{ {
StartCoroutine(FadeInternal(targetAlpha, fadeDuration, fadeAction)); StartCoroutine(fadeCoroutine = FadeInternal (targetAlpha, fadeDuration, fadeAction));
} }
/// <summary> /// <summary>
@ -410,6 +413,8 @@ namespace Fungus
public virtual void Stop() public virtual void Stop()
{ {
StopAllCoroutines(); StopAllCoroutines();
panCoroutine = null;
fadeCoroutine = null;
} }
/// <summary> /// <summary>
@ -424,8 +429,10 @@ namespace Fungus
} }
// Stop any pan that is currently active // Stop any pan that is currently active
StopAllCoroutines(); if (panCoroutine != null) {
StopCoroutine(panCoroutine);
panCoroutine = null;
}
swipePanActive = false; swipePanActive = false;
if (Mathf.Approximately(duration, 0f)) if (Mathf.Approximately(duration, 0f))
@ -444,7 +451,7 @@ namespace Fungus
} }
else else
{ {
StartCoroutine(PanInternal(camera, targetPosition, targetRotation, targetSize, duration, arriveAction)); StartCoroutine(panCoroutine = PanInternal(camera, targetPosition, targetRotation, targetSize, duration, arriveAction));
} }
} }

Loading…
Cancel
Save