Пример #1
0
        /// <summary>
        /// Remove observer from the pool.
        /// </summary>
        /// <param name="item">Observer item to be removed.</param>
        /// <param name="type">Type of the observer. Default to OOEEngineObserverType.unspecified. If unspecified, remove from all pool.</param>
        public void Remove(OOEEngineObserving item, OOEEngineObserverType type = OOEEngineObserverType.unspecified)
        {
            if (type == OOEEngineObserverType.animator)
            {
                this.RemoveAnimator(item);
            }
            else if (type == OOEEngineObserverType.physics)
            {
                this.RemovePhysicsObject(item);
            }
            else if (type == OOEEngineObserverType.graphics)
            {
                this.RemoveGraphicsObject(item);
            }
            else if (type == OOEEngineObserverType.custom)
            {
                this.RemoveCustomObserver(item);
            }
            else
            {
                this.RemoveAnimator(item);
                this.RemovePhysicsObject(item);
                this.RemoveCustomObserver(item);
                this.RemoveGraphicsObject(item);
            }

            StopTimerIfNoObserver();
        }
Пример #2
0
        // MARK:- Public method signatures


        /// <summary>
        /// Add an fps fixed update observer.
        /// </summary>
        /// <param name="item">Observer item that want to know events of the engine</param>
        /// <param name="type">Type of the observer. Default to OOEEngineObserverType.unspecified. If unspecified, remove from custom observers.</param>
        public void Add(OOEEngineObserving item, OOEEngineObserverType type = OOEEngineObserverType.unspecified)
        {
            if (type == OOEEngineObserverType.animator)
            {
                this.AddAnimator(item);
            }
            else if (type == OOEEngineObserverType.physics)
            {
                this.AddPhysicsObject(item);
            }
            else if (type == OOEEngineObserverType.graphics)
            {
                this.AddGraphicsObject(item);
            }
            else
            {
                this.AddCustomObserver(item);
            }

            StartTimerIfAnyObserver();
        }