Beispiel #1
0
        void InsertCallback(float p_time, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
        {
            hasCallbacks = true;
            HOTSeqItem newItem = new HOTSeqItem(p_time, p_callback, p_callbackWParms, p_callbackParms);

            if (items == null)
            {
                items = new List <HOTSeqItem> {
                    newItem
                };
            }
            else
            {
                bool placed     = false;
                int  itemsCount = items.Count;
                for (int i = 0; i < itemsCount; ++i)
                {
                    if (items[i].startTime >= p_time)
                    {
                        items.Insert(i, newItem);
                        placed = true;
                        break;
                    }
                }
                if (!placed)
                {
                    items.Add(newItem);
                }
            }
            _isEmpty = false;
        }
Beispiel #2
0
 public HOTSeqItem(float p_startTime, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
 {
     seqItemType    = SeqItemType.Callback;
     startTime      = p_startTime;
     callback       = p_callback;
     callbackWParms = p_callbackWParms;
     callbackParms  = p_callbackParms;
 }
Beispiel #3
0
 /// <summary>Inserts the given SendMessage callback at the given time position.</summary>
 /// <param name="p_time">Time position where this callback will be placed
 /// (if longer than the whole sequence duration, the callback will never be called)</param>
 /// <param name="p_sendMessageTarget">GameObject to target for sendMessage</param>
 /// <param name="p_methodName">Name of the method to call</param>
 /// <param name="p_value">Eventual additional parameter</param>
 /// <param name="p_options">SendMessageOptions</param>
 public void InsertCallback(float p_time, GameObject p_sendMessageTarget, string p_methodName, object p_value, SendMessageOptions p_options = SendMessageOptions.RequireReceiver)
 {
     TweenDelegate.TweenCallbackWParms cb = HOTween.DoSendMessage;
     object[] cbParms = new object[] {
         p_sendMessageTarget,
         p_methodName,
         p_value,
         p_options
     };
     InsertCallback(p_time, null, cb, cbParms);
 }
 /// <summary>
 /// Assigns the given callback to this Tweener/Sequence,
 /// overwriting any existing callbacks of the same type.
 /// This overload will use sendMessage to call the method named p_methodName
 /// on every MonoBehaviour in the p_sendMessageTarget GameObject.
 /// </summary>
 /// <param name="p_callbackType">The type of callback to apply</param>
 /// <param name="p_sendMessageTarget">GameObject to target for sendMessage</param>
 /// <param name="p_methodName">Name of the method to call</param>
 /// <param name="p_value">Eventual additional parameter</param>
 /// <param name="p_options">SendMessageOptions</param>
 public void ApplyCallback(CallbackType p_callbackType, GameObject p_sendMessageTarget, string p_methodName, object p_value, SendMessageOptions p_options = SendMessageOptions.RequireReceiver)
 {
     TweenDelegate.TweenCallbackWParms cb = HOTween.DoSendMessage;
     object[] cbParms = new object[] {
         p_sendMessageTarget,
         p_methodName,
         p_value,
         p_options
     };
     ApplyCallback(true, p_callbackType, null, cb, cbParms);
 }
        /// <summary>
        /// Completely resets this tween, except its target (in case of Tweeners).
        /// </summary>
        protected virtual void Reset()
        {
            _id    = "";
            _intId = -1;
            _autoKillOnComplete = true;
            _enabled            = true;
            _timeScale          = HOTween.defTimeScale;
            _loops                = 1;
            _loopType             = HOTween.defLoopType;
            _updateType           = HOTween.defUpdateType;
            _isPaused             = false;
            _completedLoops       = 0;
            _duration             = _originalDuration = _originalNonSpeedBasedDuration = _fullDuration = 0;
            _elapsed              = _fullElapsed = 0;
            _isEmpty              = true;
            _isReversed           = _isLoopingBack = _hasStarted = _isComplete = false;
            startupDone           = false;
            onStart               = null;
            onStartWParms         = null;
            onStartParms          = null;
            onUpdate              = null;
            onUpdateWParms        = null;
            onUpdateParms         = null;
            onPluginUpdated       = null;
            onPluginUpdatedWParms = null;
            onPluginUpdatedParms  = null;
            onStepComplete        = null;
            onStepCompleteWParms  = null;
            onStepCompleteParms   = null;
            onComplete            = null;
            onCompleteWParms      = null;
            onCompleteParms       = null;
            onPause               = null;
            onPauseWParms         = null;
            onPauseParms          = null;
            onPlay                = null;
            onPlayWParms          = null;
            onPlayParms           = null;
            onRewinded            = null;
            onRewindedWParms      = null;
            onRewindedParms       = null;

            manageBehaviours                = false;
            managedBehavioursOff            = null;
            managedBehavioursOn             = null;
            managedBehavioursOriginalState  = null;
            manageGameObjects               = false;
            managedGameObjectsOff           = null;
            managedGameObjectsOn            = null;
            managedGameObjectsOriginalState = null;
        }
        /// <summary>
        /// Assigns the given callback to this Tweener/Sequence,
        /// overwriting any existing callbacks of the same type.
        /// </summary>
        protected virtual void ApplyCallback(bool p_wParms, CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
        {
            switch (p_callbackType)
            {
            case CallbackType.OnStart:
                onStart       = p_callback;
                onStartWParms = p_callbackWParms;
                onStartParms  = p_callbackParms;
                break;

            case CallbackType.OnUpdate:
                onUpdate       = p_callback;
                onUpdateWParms = p_callbackWParms;
                onUpdateParms  = p_callbackParms;
                break;

            case CallbackType.OnStepComplete:
                onStepComplete       = p_callback;
                onStepCompleteWParms = p_callbackWParms;
                onStepCompleteParms  = p_callbackParms;
                break;

            case CallbackType.OnComplete:
                onComplete       = p_callback;
                onCompleteWParms = p_callbackWParms;
                onCompleteParms  = p_callbackParms;
                break;

            case CallbackType.OnPlay:
                onPlay       = p_callback;
                onPlayWParms = p_callbackWParms;
                onPlayParms  = p_callbackParms;
                break;

            case CallbackType.OnPause:
                onPause       = p_callback;
                onPauseWParms = p_callbackWParms;
                onPauseParms  = p_callbackParms;
                break;

            case CallbackType.OnRewinded:
                onRewinded       = p_callback;
                onRewindedWParms = p_callbackWParms;
                onRewindedParms  = p_callbackParms;
                break;

            case CallbackType.OnPluginOverwritten:
                TweenWarning.Log("ApplyCallback > OnPluginOverwritten type is available only with Tweeners and not with Sequences");
                break;
            }
        }
Beispiel #7
0
        /// <summary>
        /// Assigns the given callback to this Tweener/Sequence,
        /// overwriting any existing callbacks of the same type.
        /// </summary>
        protected override void ApplyCallback(bool p_wParms, CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
        {
            switch (p_callbackType)
            {
            case CallbackType.OnPluginOverwritten:
                onPluginOverwritten       = p_callback;
                onPluginOverwrittenWParms = p_callbackWParms;
                onPluginOverwrittenParms  = p_callbackParms;
                break;

            default:
                base.ApplyCallback(p_wParms, p_callbackType, p_callback, p_callbackWParms, p_callbackParms);
                break;
            }
        }
 /// <summary>
 /// Assigns the given callback to this Tweener/Sequence,
 /// overwriting any existing callbacks of the same type.
 /// </summary>
 /// <param name="p_callbackType">The type of callback to apply</param>
 /// <param name="p_callback">The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/></param>
 /// <param name="p_callbackParms">Additional comma separated parameters to pass to the function</param>
 public void ApplyCallback(CallbackType p_callbackType, TweenDelegate.TweenCallbackWParms p_callback, params object[] p_callbackParms)
 {
     ApplyCallback(true, p_callbackType, null, p_callback, p_callbackParms);
 }
Beispiel #9
0
 /// <summary>
 /// Function to call each time a single loop of the Sequence is completed.
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public SequenceParms OnStepComplete(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onStepCompleteWParms = p_function;
     onStepCompleteParms = p_funcParms;
     return this;
 }
Beispiel #10
0
 /// <summary>
 /// Assigns the given callback to this Tweener/Sequence,
 /// overwriting any existing callbacks of the same type.
 /// </summary>
 protected override void ApplyCallback(bool p_wParms, CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
 {
     switch (p_callbackType) {
         case CallbackType.OnPluginOverwritten:
             onPluginOverwritten = p_callback;
             onPluginOverwrittenWParms = p_callbackWParms;
             onPluginOverwrittenParms = p_callbackParms;
             break;
         default:
             base.ApplyCallback(p_wParms, p_callbackType, p_callback, p_callbackWParms, p_callbackParms);
             break;
     }
 }
Beispiel #11
0
 /// <summary>Inserts the given callback at the given time position.</summary>
 /// <param name="p_time">Time position where this callback will be placed
 /// (if longer than the whole sequence duration, the callback will never be called)</param>
 /// <param name="p_callback">The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/></param>
 /// <param name="p_callbackParms">Additional comma separated parameters to pass to the function</param>
 public void InsertCallback(float p_time, TweenDelegate.TweenCallbackWParms p_callback, params object[] p_callbackParms)
 {
     InsertCallback(p_time, null, p_callback, p_callbackParms);
 }
Beispiel #12
0
 /// <summary>
 /// Function to call when the full Tweener, loops included, is completed.
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnComplete(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onCompleteWParms = p_function;
     onCompleteParms  = p_funcParms;
     return(this);
 }
Beispiel #13
0
 /// <summary>
 /// Function to call when one of the plugins used in the tween gets overwritten
 /// (available only if OverwriteManager is active).
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnPluginOverwritten(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onPluginOverwrittenWParms = p_function;
     onPluginOverwrittenParms  = p_funcParms;
     return(this);
 }
Beispiel #14
0
 /// <summary>Appends the given callback to this Sequence.</summary>
 /// <param name="p_callback">The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/></param>
 /// <param name="p_callbackParms">Additional comma separated parameters to pass to the function</param>
 public void AppendCallback(TweenDelegate.TweenCallbackWParms p_callback, params object[] p_callbackParms)
 {
     InsertCallback(_duration, p_callback, p_callbackParms);
 }
Beispiel #15
0
 public HOTSeqItem(float p_startTime, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
 {
     seqItemType = SeqItemType.Callback;
     startTime = p_startTime;
     callback = p_callback;
     callbackWParms = p_callbackWParms;
     callbackParms = p_callbackParms;
 }
        /// <summary>
        /// Completely resets this tween, except its target (in case of Tweeners).
        /// </summary>
        protected virtual void Reset()
        {
            _id = "";
            _intId = -1;
            _autoKillOnComplete = true;
            _enabled = true;
            _timeScale = HOTween.defTimeScale;
            _loops = 1;
            _loopType = HOTween.defLoopType;
            _updateType = HOTween.defUpdateType;
            _isPaused = false;
            _completedLoops = 0;
            _duration = _originalDuration = _originalNonSpeedBasedDuration = _fullDuration = 0;
            _elapsed = _fullElapsed = 0;
            _isEmpty = true;
            _isReversed = _isLoopingBack = _hasStarted = _isComplete = false;
            startupDone = false;
            onStart = null;
            onStartWParms = null;
            onStartParms = null;
            onUpdate = null;
            onUpdateWParms = null;
            onUpdateParms = null;
            onPluginUpdated = null;
            onPluginUpdatedWParms = null;
            onPluginUpdatedParms = null;
            onStepComplete = null;
            onStepCompleteWParms = null;
            onStepCompleteParms = null;
            onComplete = null;
            onCompleteWParms = null;
            onCompleteParms = null;
            onPause = null;
            onPauseWParms = null;
            onPauseParms = null;
            onPlay = null;
            onPlayWParms = null;
            onPlayParms = null;
            onRewinded = null;
            onRewindedWParms = null;
            onRewindedParms = null;

            manageBehaviours = false;
            managedBehavioursOff = null;
            managedBehavioursOn = null;
            managedBehavioursOriginalState = null;
            manageGameObjects = false;
            managedGameObjectsOff = null;
            managedGameObjectsOn = null;
            managedGameObjectsOriginalState = null;
        }
Beispiel #17
0
 /// <summary>
 /// Function to call when the Sequence switches from a paused state to a playing state.
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public SequenceParms OnPlay(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onPlayWParms = p_function;
     onPlayParms = p_funcParms;
     return this;
 }
 /// <summary>
 /// Assigns the given callback to this Tweener/Sequence,
 /// overwriting any existing callbacks of the same type.
 /// </summary>
 protected virtual void ApplyCallback(bool p_wParms, CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
 {
     switch (p_callbackType) {
         case CallbackType.OnStart:
             onStart = p_callback;
             onStartWParms = p_callbackWParms;
             onStartParms = p_callbackParms;
             break;
         case CallbackType.OnUpdate:
             onUpdate = p_callback;
             onUpdateWParms = p_callbackWParms;
             onUpdateParms = p_callbackParms;
             break;
         case CallbackType.OnStepComplete:
             onStepComplete = p_callback;
             onStepCompleteWParms = p_callbackWParms;
             onStepCompleteParms = p_callbackParms;
             break;
         case CallbackType.OnComplete:
             onComplete = p_callback;
             onCompleteWParms = p_callbackWParms;
             onCompleteParms = p_callbackParms;
             break;
         case CallbackType.OnPlay:
             onPlay = p_callback;
             onPlayWParms = p_callbackWParms;
             onPlayParms = p_callbackParms;
             break;
         case CallbackType.OnPause:
             onPause = p_callback;
             onPauseWParms = p_callbackWParms;
             onPauseParms = p_callbackParms;
             break;
         case CallbackType.OnRewinded:
             onRewinded = p_callback;
             onRewindedWParms = p_callbackWParms;
             onRewindedParms = p_callbackParms;
             break;
         case CallbackType.OnPluginOverwritten:
             TweenWarning.Log("ApplyCallback > OnPluginOverwritten type is available only with Tweeners and not with Sequences");
             break;
     }
 }
Beispiel #19
0
 /// <summary>
 /// Function to call when one of the plugins used in the tween gets overwritten
 /// (available only if OverwriteManager is active).
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnPluginOverwritten(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onPluginOverwrittenWParms = p_function;
     onPluginOverwrittenParms = p_funcParms;
     return this;
 }
Beispiel #20
0
 /// <summary>
 /// Function to call when the Tweener switches from a paused state to a playing state.
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnPlay(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onPlayWParms = p_function;
     onPlayParms  = p_funcParms;
     return(this);
 }
Beispiel #21
0
 /// <summary>
 /// Function to call each time the Tweener is rewinded from a non-rewinded state
 /// (either because of a direct call to Rewind,
 /// or because the tween's virtual playehead reached the start due to a playing backwards behaviour).
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnRewinded(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onRewindedWParms = p_function;
     onRewindedParms  = p_funcParms;
     return(this);
 }
Beispiel #22
0
 /// <summary>
 /// Set a callback with parameters for this tween
 /// </summary>
 /// <param name="callback"></param>
 /// <returns></returns>
 public HOTweenHelper OnComplete(TweenDelegate.TweenCallbackWParms callback)
 {
     ParamUtil.OnComplete(callback);
     return(this);
 }