Пример #1
0
 public void CrossFade(float fadeLength, QueueMode queueMode = QueueMode.PlayNow, PlayMode playMode = PlayMode.StopSameLayer)
 {
     if (_routine == null)
     {
         throw new System.ObjectDisposedException("ISPAnim");
     }
     if (_routine.OperatingState == RadicalCoroutineOperatingState.Inactive)
     {
         _routine.Start(_controller, RadicalCoroutineDisableMode.Pauses);
     }
 }
        public static RadicalCoroutine StartRadicalCoroutine(this MonoBehaviour behaviour, System.Delegate method, object[] args = null, RadicalCoroutineDisableMode disableMode = RadicalCoroutineDisableMode.Default)
        {
            if (behaviour == null)
            {
                throw new System.ArgumentNullException("behaviour");
            }
            if (method == null)
            {
                throw new System.ArgumentNullException("method");
            }

            System.Collections.IEnumerator e;
            if (com.spacepuppy.Utils.TypeUtil.IsType(method.Method.ReturnType, typeof(System.Collections.IEnumerable)))
            {
                e = (method.DynamicInvoke(args) as System.Collections.IEnumerable).GetEnumerator();
            }
            else if (com.spacepuppy.Utils.TypeUtil.IsType(method.Method.ReturnType, typeof(System.Collections.IEnumerator)))
            {
                e = (method.DynamicInvoke(args) as System.Collections.IEnumerator);
            }
            else
            {
                throw new System.ArgumentException("Delegate must have a return type of IEnumerable or IEnumerator.", "method");
            }

            var co = new RadicalCoroutine(e);

            co.Start(behaviour, disableMode);
            return(co);
        }
        public void MakeActiveStyle(bool stackState = false)
        {
            if (!this.isActiveAndEnabled)
            {
                return;
            }

            if (_mode == UpdateMode.Motor)
            {
                if (stackState)
                {
                    _motor.States.StackState(this);
                }
                else
                {
                    _motor.States.ChangeState(this);
                }
            }
            else
            {
                _activeStatus = true;
                if (_routine == null || _routine.Finished)
                {
                    _routine = this.StartRadicalCoroutine(this.SelfUpdateRoutine(), RadicalCoroutineDisableMode.Pauses);
                }
                else if (_routine.OperatingState == RadicalCoroutineOperatingState.Inactive)
                {
                    _routine.Start(this, RadicalCoroutineDisableMode.Pauses);
                }
            }
        }
        public static RadicalCoroutine StartRadicalCoroutine(this MonoBehaviour behaviour, System.Collections.IEnumerator routine)
        {
            if (behaviour == null) throw new System.ArgumentNullException("behaviour");
            if (routine == null) throw new System.ArgumentNullException("routine");

            var co = new RadicalCoroutine(routine);
            co.Start(behaviour);
            return co;
        }
        public static RadicalCoroutine StartRadicalCoroutine(this MonoBehaviour behaviour, System.Func<System.Collections.IEnumerator> method, RadicalCoroutineDisableMode disableMode = RadicalCoroutineDisableMode.Default)
        {
            if (behaviour == null) throw new System.ArgumentNullException("behaviour");
            if (method == null) throw new System.ArgumentNullException("routine");

            var co = new RadicalCoroutine(method());
            co.Start(behaviour, disableMode);
            return co;
        }
        public RadicalCoroutine StartRadicalCoroutine(System.Func <System.Collections.IEnumerator> routine, RadicalCoroutineDisableMode disableMode = RadicalCoroutineDisableMode.Default)
        {
            if (routine == null)
            {
                throw new System.ArgumentNullException("routine");
            }

            var co = new RadicalCoroutine(routine());

            co.Start(this, disableMode);
            return(co);
        }
        public static RadicalCoroutine StartRadicalCoroutine(this MonoBehaviour behaviour, System.Func <System.Collections.IEnumerator> method, RadicalCoroutineDisableMode disableMode = RadicalCoroutineDisableMode.Default)
        {
            if (behaviour == null)
            {
                throw new System.ArgumentNullException("behaviour");
            }
            if (method == null)
            {
                throw new System.ArgumentNullException("routine");
            }

            var co = new RadicalCoroutine(method());

            co.Start(behaviour, disableMode);
            return(co);
        }
Пример #8
0
        private void TryStartRoutine()
        {
            if (!this.isActiveAndEnabled)
            {
                return;
            }

            if (!_useProximityTrigger || (_nearColliders != null && _nearColliders.Count > 0))
            {
                if (_routine == null || _routine.Finished)
                {
                    _routine = this.StartRadicalCoroutine(this.SenseRoutine(), RadicalCoroutineDisableMode.Pauses);
                }
                else if (!_routine.Active)
                {
                    _routine.Start(this, RadicalCoroutineDisableMode.Pauses);
                }
            }
        }
        public static RadicalCoroutine StartValidatedRadicalCoroutine(this MonoBehaviour behaviour, System.Collections.IEnumerator routine, System.Func <bool> validator, RadicalCoroutineDisableMode disableMode = RadicalCoroutineDisableMode.Default)
        {
            if (behaviour == null)
            {
                throw new System.ArgumentNullException("behaviour");
            }
            if (routine == null)
            {
                throw new System.ArgumentNullException("routine");
            }
            if (validator == null)
            {
                throw new System.ArgumentNullException("validator");
            }

            var co = new RadicalCoroutine(ValidatedRoutine(routine, validator));

            co.Start(behaviour, disableMode);
            return(co);
        }
        public static RadicalCoroutine StartRadicalCoroutine(this MonoBehaviour behaviour, CoroutineMethod method)
        {
            if (behaviour == null) throw new System.ArgumentNullException("behaviour");
            if (method == null) throw new System.ArgumentNullException("routine");

            var co = new RadicalCoroutine(method().GetEnumerator());
            co.Start(behaviour);
            return co;
        }
        public static RadicalCoroutine StartRadicalCoroutine(this MonoBehaviour behaviour, System.Delegate method, object[] args = null, RadicalCoroutineDisableMode disableMode = RadicalCoroutineDisableMode.Default)
        {
            if (behaviour == null) throw new System.ArgumentNullException("behaviour");
            if (method == null) throw new System.ArgumentNullException("method");

            System.Collections.IEnumerator e;
            if (com.spacepuppy.Utils.TypeUtil.IsType(method.Method.ReturnType, typeof(System.Collections.IEnumerable)))
            {
                e = (method.DynamicInvoke(args) as System.Collections.IEnumerable).GetEnumerator();
            }
            else if (com.spacepuppy.Utils.TypeUtil.IsType(method.Method.ReturnType, typeof(System.Collections.IEnumerator)))
            {
                e = (method.DynamicInvoke(args) as System.Collections.IEnumerator);
            }
            else
            {
                throw new System.ArgumentException("Delegate must have a return type of IEnumerable or IEnumerator.", "method");
            }

            var co = new RadicalCoroutine(e);
            co.Start(behaviour, disableMode);
            return co;
        }