|
|
@ -54,10 +54,10 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
protected static CameraController instance; |
|
|
|
protected static CameraController instance; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Returns the CameraController singleton instance. |
|
|
|
/// Returns the CameraController singleton instance. |
|
|
|
* Will create a CameraController game object if none currently exists. |
|
|
|
/// Will create a CameraController game object if none currently exists. |
|
|
|
*/ |
|
|
|
/// </summary> |
|
|
|
static public CameraController GetInstance() |
|
|
|
static public CameraController GetInstance() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (instance == null) |
|
|
|
if (instance == null) |
|
|
@ -117,17 +117,17 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Perform a fullscreen fade over a duration. |
|
|
|
/// Perform a fullscreen fade over a duration. |
|
|
|
*/ |
|
|
|
/// </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(FadeInternal(targetAlpha, fadeDuration, fadeAction)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Fade out, move camera to view and then fade back in. |
|
|
|
/// Fade out, move camera to view and then fade back in. |
|
|
|
*/ |
|
|
|
/// </summary> |
|
|
|
public virtual void FadeToView(Camera camera, View view, float fadeDuration, bool fadeOut, Action fadeAction) |
|
|
|
public virtual void FadeToView(Camera camera, View view, float fadeDuration, bool fadeOut, Action fadeAction) |
|
|
|
{ |
|
|
|
{ |
|
|
|
swipePanActive = false; |
|
|
|
swipePanActive = false; |
|
|
@ -195,10 +195,9 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Positions camera so sprite is centered and fills the screen. |
|
|
|
/// Positions camera so sprite is centered and fills the screen. |
|
|
|
* @param spriteRenderer The sprite to center the camera on |
|
|
|
/// </summary> |
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual void CenterOnSprite(Camera camera, SpriteRenderer spriteRenderer) |
|
|
|
public virtual void CenterOnSprite(Camera camera, SpriteRenderer spriteRenderer) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (camera == null) |
|
|
|
if (camera == null) |
|
|
@ -231,9 +230,9 @@ namespace Fungus |
|
|
|
PanToPosition(camera, view.transform.position, view.transform.rotation, view.ViewSize, duration, arriveAction); |
|
|
|
PanToPosition(camera, view.transform.position, view.transform.rotation, view.ViewSize, duration, arriveAction); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Moves camera from current position to a target position over a period of time. |
|
|
|
/// Moves camera from current position to a target position over a period of time. |
|
|
|
*/ |
|
|
|
/// </summary> |
|
|
|
public virtual void PanToPosition(Camera camera, Vector3 targetPosition, Quaternion targetRotation, float targetSize, float duration, Action arriveAction) |
|
|
|
public virtual void PanToPosition(Camera camera, Vector3 targetPosition, Quaternion targetRotation, float targetSize, float duration, Action arriveAction) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (camera == null) |
|
|
|
if (camera == null) |
|
|
@ -267,9 +266,9 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Stores the current camera view using a name. |
|
|
|
/// Stores the current camera view using a name. |
|
|
|
*/ |
|
|
|
/// </summary> |
|
|
|
public virtual void StoreView(Camera camera, string viewName) |
|
|
|
public virtual void StoreView(Camera camera, string viewName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (camera != null) |
|
|
|
if (camera != null) |
|
|
@ -285,9 +284,9 @@ namespace Fungus |
|
|
|
storedViews[viewName] = currentView; |
|
|
|
storedViews[viewName] = currentView; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Moves the camera to a previously stored camera view over a period of time. |
|
|
|
/// Moves the camera to a previously stored camera view over a period of time. |
|
|
|
*/ |
|
|
|
/// </summary> |
|
|
|
public virtual void PanToStoredView(Camera camera, string viewName, float duration, Action arriveAction) |
|
|
|
public virtual void PanToStoredView(Camera camera, string viewName, float duration, Action arriveAction) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (camera == null) |
|
|
|
if (camera == null) |
|
|
@ -380,9 +379,9 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Moves camera smoothly through a sequence of Views over a period of time |
|
|
|
/// Moves camera smoothly through a sequence of Views over a period of time. |
|
|
|
*/ |
|
|
|
/// </summary> |
|
|
|
public virtual void PanToPath(Camera camera, View[] viewList, float duration, Action arriveAction) |
|
|
|
public virtual void PanToPath(Camera camera, View[] viewList, float duration, Action arriveAction) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (camera == null) |
|
|
|
if (camera == null) |
|
|
@ -447,10 +446,9 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Activates swipe panning mode. |
|
|
|
/// Activates swipe panning mode. The player can pan the camera within the area between viewA & viewB. |
|
|
|
* The player can pan the camera within the area between viewA & viewB. |
|
|
|
/// </summary> |
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual void StartSwipePan(Camera camera, View viewA, View viewB, float duration, float speedMultiplier, Action arriveAction) |
|
|
|
public virtual void StartSwipePan(Camera camera, View viewA, View viewB, float duration, float speedMultiplier, Action arriveAction) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (camera == null) |
|
|
|
if (camera == null) |
|
|
@ -480,9 +478,9 @@ namespace Fungus |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/// <summary> |
|
|
|
* Deactivates swipe panning mode. |
|
|
|
/// Deactivates swipe panning mode. |
|
|
|
*/ |
|
|
|
/// </summary> |
|
|
|
public virtual void StopSwipePan() |
|
|
|
public virtual void StopSwipePan() |
|
|
|
{ |
|
|
|
{ |
|
|
|
swipePanActive = false; |
|
|
|
swipePanActive = false; |
|
|
|