//=====================================================================================================================//
        //================================================== Editing Methods ==================================================//
        //=====================================================================================================================//

        #region Editing Methods

        private void ClearAllExcept(IGameEventTarget target)
        {
            if (target != _gameObjectTarget)
            {
                _gameObjectTarget = null;
            }

            if (target != _timelineTarget)
            {
                _timelineTarget = null;
            }

            if (target != _eventTarget)
            {
                _eventTarget = null;
            }

            if (target != _animatorTarget)
            {
                _animatorTarget = null;
            }

            if (target != _behaviourTarget)
            {
                _behaviourTarget = null;
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="original"></param>
        /// <returns></returns>
        public static GameObjectTarget Clone(GameObjectTarget original)
        {
            if (original == null)
            {
                return(null);
            }

            var newTarget = new GameObjectTarget {
                action          = original.action,
                gameObject      = original.gameObject,
                broadcastTarget = original.broadcastTarget,
                parameter       = CallbackParameter.Clone(original.parameter),
                _methodName     = original._methodName
            };

            if (original.cachedListeners != null)
            {
                newTarget.cachedListeners = new List <IGameEventListener>(original.cachedListeners);
            }

            if (original._cachedListenersView != null)
            {
                newTarget._cachedListenersView = new List <MonoBehaviour>(original._cachedListenersView);
            }

            return(newTarget);
        }
        //=====================================================================================================================//
        //=================================================== Public Methods ==================================================//
        //=====================================================================================================================//

        #region Public Methods

        public static GameEventTarget Clone(GameEventTarget original)
        {
            if (original == null)
            {
                return(null);
            }

            var newTarget = new GameEventTarget {
                _targetType = original._targetType,

                _animatorTarget   = AnimatorTarget.Clone(original._animatorTarget),
                _behaviourTarget  = BehaviourTarget.Clone(original._behaviourTarget),
                _eventTarget      = EventIDTarget.Clone(original._eventTarget),
                _gameObjectTarget = GameObjectTarget.Clone(original._gameObjectTarget),
                _timelineTarget   = TimelineTarget.Clone(original._timelineTarget),

                _replayOnLoad = original._replayOnLoad,
                _isMuted      = original._isMuted
            };

            return(newTarget);
        }