Esempio n. 1
0
        public static void Initiate()
        {
            if (isInitialized)
            {
                return;
            }

            isInitialized = true;
            InvocationFlow <MonoBehaviour> .IsValid   = (MonoBehaviour script) => script != null;            // check valid with Unity's overloaded Null Operator
            InvocationFlow <MonoBehaviour> .IsEnabled = (MonoBehaviour script) => script.isActiveAndEnabled; // check if behaviour is running update
            InvocationFlow <MonoBehaviour> .LinkDeltaTimeProperties(typeof(Time).GetProperty(nameof(Time.deltaTime)), typeof(Time).GetProperty(nameof(Time.unscaledDeltaTime)));

            singleton = new GameObject("InvocationFlowController", typeof(InvocationFlowController));
        }
 // delay 1 frame
 public static void InvokeNextFrame(Action func)
 {
     InvocationFlow <MonoBehaviour> .InvokeDelayedFrames(StaticController, 1, func);
 }
 public static void InvokeDelayedFrames(int delayFrames, Action func)
 {
     InvocationFlow <MonoBehaviour> .InvokeDelayedFrames(StaticController, delayFrames, func);
 }
 public static void InvokeDelayed(float delayTime, Action func, bool scaledTime = true)
 {
     InvocationFlow <MonoBehaviour> .InvokeDelayed(StaticController, delayTime, func, scaledTime);
 }
 // delay 1 frame
 public static void InvokeDelayed(Action func, bool scaledTime = true)
 {
     InvocationFlow <MonoBehaviour> .InvokeDelayedFramesInvokeDelayed(StaticController, 1, func, scaledTime);
 }
Esempio n. 6
0
 static InvocationFlowController()
 {
     InvocationFlow <Behaviour> .IsValid = (Behaviour x) => x.Valid;
     InvocationFlow <Behaviour> .LinkDeltaTimeProperties(typeof(InvocationFlowController).GetProperty(nameof(deltaTime)), typeof(InvocationFlowController).GetProperty(nameof(unscaledDeltaTime)));
 }
Esempio n. 7
0
 public static void InvokeWhen(this Behaviour behaviour, Action func, Func <bool> condition)
 {
     InvocationFlow <Behaviour> .InvokeWhen(behaviour, func, condition);
 }
 public static void InvokeWhile(this MonoBehaviour script, Action func, Func <bool> condition)
 {
     InvocationFlow <MonoBehaviour> .InvokeWhile(script, func, condition);
 }
 public static void TimeLerpValue(this MonoBehaviour script, float lerpTime, float startVal, float endVal, Action <float> func, bool scaledTime = true)
 {
     InvocationFlow <MonoBehaviour> .TimeLerpValue(script, lerpTime, startVal, endVal, func, scaledTime);
 }
 // delay 1 frame
 public static void InvokeNextFrame(this MonoBehaviour script, Action func)
 {
     InvocationFlow <MonoBehaviour> .InvokeDelayedFrames(script, 1, func);
 }
 public static void InvokeDelayed(this MonoBehaviour script, int delayFrames, Action func)
 {
     InvocationFlow <MonoBehaviour> .InvokeDelayedFrames(script, delayFrames, func);
 }
 public static void InvokeDelayed(this MonoBehaviour script, float delayTime, Action func, bool scaledTime = true)
 {
     InvocationFlow <MonoBehaviour> .InvokeDelayed(script, delayTime, func, scaledTime);
 }
Esempio n. 13
0
 // Execution order is expected to be after update but before coroutines as long as execution order is not changed.
 void Update()
 {
     InvocationFlow <MonoBehaviour> .IterateInvocationHandlers();
 }
 // Execution order is expected to be after update but before coroutines as long as execution order is not changed.
 void Update()
 {
     InvocationFlow <MonoBehaviour> .IterateInvocationHandlers(Time.deltaTime, Time.unscaledDeltaTime);
 }
 public static void TimeLerpValueThen(float lerpTime, float startVal, float endVal, Action <float> func, Action onComplete, bool scaledTime = true)
 {
     InvocationFlow <MonoBehaviour> .TimeLerpValueThen(StaticController, lerpTime, startVal, endVal, func, onComplete, scaledTime);
 }
 public static void TimeLerpValue(this MonoBehaviour script, float lerpTime, Vector3 startVal, Vector3 endVal, Action <Vector3> func, bool scaledTime = true)
 {
     InvocationFlow <MonoBehaviour> .TimeLerpValue <Vector3>(script, lerpTime, startVal, endVal, Vector3.Lerp, func, scaledTime);
 }
 public static void TimeLerpValueThen <T>(float lerpTime, T startVal, T endVal, Func <T, T, float, T> lerpFunction, Action <T> func, Action onComplete, bool scaledTime = true)
 {
     InvocationFlow <MonoBehaviour> .TimeLerpValueThen <T>(StaticController, lerpTime, startVal, endVal, lerpFunction, func, onComplete, scaledTime);
 }
 public static void TimeLerpValue <T>(this MonoBehaviour script, float lerpTime, T startVal, T endVal, Func <T, T, float, T> lerpFunction, Action <T> func, bool scaledTime = true)
 {
     InvocationFlow <MonoBehaviour> .TimeLerpValue <T>(script, lerpTime, startVal, endVal, lerpFunction, func, scaledTime);
 }
 public static void InvokeWhileThen(this MonoBehaviour script, Action func, Func <bool> condition, Action onComplete)
 {
     InvocationFlow <MonoBehaviour> .InvokeWhileThen(script, func, condition, onComplete);
 }
 public static void InvokeWhile(Action func, Func <bool> condition)
 {
     InvocationFlow <MonoBehaviour> .InvokeWhile(StaticController, func, condition);
 }
Esempio n. 21
0
 public static void TimeLerpValue(this Behaviour behaviour, float lerpTime, float startVal, float endVal, Action <float> func)
 {
     InvocationFlow <Behaviour> .TimeLerpValue(behaviour, lerpTime, startVal, endVal, func);
 }
 public static void InvokeWhileThen(Action func, Func <bool> condition, Action onComplete)
 {
     InvocationFlow <MonoBehaviour> .InvokeWhileThen(StaticController, func, condition, onComplete);
 }
Esempio n. 23
0
 public void Tick()
 {
     InvocationFlow <Behaviour> .IterateInvocationHandlers();
 }
 // delay 1 frame
 public static void InvokeDelayed(this MonoBehaviour script, Action func, bool scaledTime = true)
 {
     InvocationFlow <MonoBehaviour> .InvokeDelayedFramesInvokeDelayed(script, 1, func, scaledTime);
 }