Exemplo n.º 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();
        }
Exemplo n.º 2
0
 public void RemoveGraphicsObject(OOEEngineObserving graphicsObject)
 {
     if (graphicsObject == null)
     {
         return;
     }
     graphicsObjects.Remove(graphicsObject);
 }
Exemplo n.º 3
0
 private void RemoveCustomObserver(OOEEngineObserving customObserver)
 {
     if (customObserver == null)
     {
         return;
     }
     customObservers.Remove(customObserver);
 }
Exemplo n.º 4
0
 private void RemovePhysicsObject(OOEEngineObserving physicsObject)
 {
     if (physicsObject == null)
     {
         return;
     }
     physicsObjects.Remove(physicsObject);
 }
Exemplo n.º 5
0
 private void RemoveAnimator(OOEEngineObserving animator)
 {
     if (animator == null)
     {
         return;
     }
     animators.Remove(animator);
 }
Exemplo n.º 6
0
 public void AddGraphicsObject(OOEEngineObserving graphicsObject)
 {
     if (graphicsObject == null)
     {
         return;
     }
     if (graphicsObjects.Contains(graphicsObject) == false)
     {
         graphicsObjects.Add(graphicsObject);
     }
 }
Exemplo n.º 7
0
 private void AddCustomObserver(OOEEngineObserving customObserver)
 {
     if (customObserver == null)
     {
         return;
     }
     if (customObservers.Contains(customObserver) == false)
     {
         customObservers.Add(customObserver);
     }
 }
Exemplo n.º 8
0
 private void AddPhysicsObject(OOEEngineObserving physicsObject)
 {
     if (physicsObject == null)
     {
         return;
     }
     if (physicsObjects.Contains(physicsObject) == false)
     {
         physicsObjects.Add(physicsObject);
     }
 }
Exemplo n.º 9
0
 private void AddAnimator(OOEEngineObserving animator)
 {
     if (animator == null)
     {
         return;
     }
     if (animators.Contains(animator) == false)
     {
         animators.Add(animator);
     }
 }
Exemplo n.º 10
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();
        }