/// <summary> /// Extension method to start a curve's Run routine on a given MonoBehaviour if it is not already active /// isActive is set true before evaluation and set false afterward /// </summary> /// <access>public static void</access> /// <param name="behaviour" type="this MonoBehaviour">The behaviour to start the routine on</param> /// <param name="curve" type="CurveAsset">The curve to get the routine from</param> /// <param name="callback" type="Action(float)">Callback action that takes an input float value</param> /// <param name="isActive" type="Reference<bool>"Is the curve already being run?</param> /// <seealso cref="CurveAsset.Run(Action{float})" /> public static void RunCurve(this MonoBehaviour behaviour, CurveAsset curve, Action <float> callback, Reference <bool> isActive) { if (isActive) { return; } behaviour.StartCoroutine(curve.Run(callback, () => isActive.Set(true), () => isActive.Set(false))); }
/// <summary> /// Extension method to start a curve's Run routine on a given MonoBehaviour if it is not already active /// isActive is set true before calling onStart and set false after calling onEnd /// </summary> /// <access>public static void</access> /// <param name="behaviour" type="this MonoBehaviour">The behaviour to start the routine on</param> /// <param name="curve" type="CurveAsset">The curve to get the routine from</param> /// <param name="duration" type="float">Inverse scale factor for input time</param> /// <param name="scale" type="float">Scale factor for curve value</param> /// <param name="callback" type="Action(float)">Callback action that takes an input float value</param> /// <param name="onStart" type="Action()">Action run before curve evaluation begins</param> /// <param name="onEnd" type="Action()">Action run after curve evaluation finishes</param> /// <param name="isActive" type="Reference<bool>"Is the curve already being run?</param> /// <seealso cref="CurveAsset.Run(float, float, Action{float}, Action, Action)" /> public static void RunCurve(this MonoBehaviour behaviour, CurveAsset curve, float duration, float scale, Action <float> callback, Action onStart, Action onEnd, Reference <bool> isActive) { if (isActive) { return; } behaviour.StartCoroutine(curve.Run(duration, scale, callback, () => { isActive.Set(true); onStart(); }, () => { onEnd(); isActive.Set(false); })); }
/// <summary> /// Extension method to start a curve's Run routine on a given MonoBehaviour /// </summary> /// <access>public static void</access> /// <param name="behaviour" type="this MonoBehaviour">The behaviour to start the routine on</param> /// <param name="curve" type="CurveAsset">The curve to get the routine from</param> /// <param name="callback" type="Action(float)">Callback action that takes an input float value</param> /// <param name="onStart" type="Action()">Action run before curve evaluation begins</param> /// <param name="onEnd" type="Action()">Action run after curve evaluation finishes</param> /// <seealso cref="CurveAsset.Run(Action{float}, Action, Action)" /> public static void RunCurve(this MonoBehaviour behaviour, CurveAsset curve, Action <float> callback, Action onStart, Action onEnd) { behaviour.StartCoroutine(curve.Run(callback, onStart, onEnd)); }
/// <summary> /// Extension method to start a curve's Run routine on a given MonoBehaviour /// </summary> /// <access>public static void</access> /// <param name="behaviour" type="this MonoBehaviour">The behaviour to start the routine on</param> /// <param name="curve" type="CurveAsset">The curve to get the routine from</param> /// <param name="callback" type="Action(float)">Callback action that takes an input float value</param> /// <seealso cref="CurveAsset.Run(Action{float})" /> public static Coroutine RunCurve(this MonoBehaviour behaviour, CurveAsset curve, Action <float> callback) { return(behaviour.StartCoroutine(curve.Run(callback))); }
/// <summary> /// Extension method to start a curve's Run routine on a given MonoBehaviour /// </summary> /// <access>public static void</access> /// <param name="behaviour" type="this MonoBehaviour">The behaviour to start the routine on</param> /// <param name="curve" type="CurveAsset">The curve to get the routine from</param> /// <param name="duration" type="float">Inverse scale factor for input time</param> /// <param name="scale" type="float">Scale factor for curve value</param> /// <param name="callback" type="Action(float)">Callback action that takes an input float value</param> /// <seealso cref="CurveAsset.Run(float, float, Action{float})" /> public static void RunCurve(this MonoBehaviour behaviour, CurveAsset curve, float duration, float scale, Action <float> callback) { behaviour.StartCoroutine(curve.Run(duration, scale, callback)); }