Beispiel #1
0
        public Operation(
            string name                                = null,
            float duration                             = 0,
            float delay                                = 0,
            bool ignoreTimeScale                       = false,
            EaseCurve?ease                             = null,
            OperationAction action                     = null,
            OperationUpdateAction updateAction         = null,
            OperationEndAction endAction               = null,
            OperationWaitForCondition waitForCondition = null,
            OperationSkipCondition skipCondition       = null,
            OperationFinishCondition finishCondition   = null)
        {
            #if UNITY_EDITOR
            // Can't start on editor mode
            Assert.IsTrue(Application.isPlaying);
            #endif

            // -- Validity checks -- //
            // Check if duration and finish condition both supplied
            var isDurationSupplied = duration > 0;
            Assert.IsFalse(isDurationSupplied && finishCondition != null, "Duration and finish condition both can't be supplied!");
            // Ease can't be used if no duration is set
            Assert.IsTrue(ease == null || isDurationSupplied, "Ease can't be used if no duration is set!");

#if UNITY_EDITOR
            // Set default name in editor as calling method name
            if (string.IsNullOrEmpty(name))
            {
                name = new StackFrame(1).GetMethod().Name;
            }
#endif

            Name              = name;
            _duration         = duration;
            Delay             = delay;
            IsIgnoreTimeScale = ignoreTimeScale;

            _ease = ease;

            _action           = action;
            _updateAction     = updateAction;
            _endAction        = endAction;
            _finishCondition  = finishCondition;
            _waitForCondition = waitForCondition;
            _skipCondition    = skipCondition;
        }
Beispiel #2
0
        public Operation Add(
            string name                                = null,
            float duration                             = 0,
            float delay                                = 0,
            bool ignoreTimeScale                       = false,
            EaseCurve?ease                             = null,
            AnimationCurve easeCurve                   = null,
            OperationAction action                     = null,
            OperationUpdateAction updateAction         = null,
            OperationEndAction endAction               = null,
            OperationWaitForCondition waitForCondition = null,
            OperationSkipCondition skipCondition       = null,
            OperationFinishCondition finishCondition   = null)
        {
            var newOp = new Operation(name, duration, delay, ignoreTimeScale, ease, action, updateAction, endAction, waitForCondition, skipCondition,
                                      finishCondition);

            return(Add(newOp));
        }