Ejemplo n.º 1
0
 public void Add(T instance)
 {
     if (ObjectsToRemove.Contains(instance))
     {
         ObjectsToRemove.Remove(instance);
     }
     if (!ObjectsToAdd.Contains(instance))
     {
         ObjectsToAdd.Add(instance);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// A function to add a child
        /// </summary>
        /// <typeparam name="K">The type of the child</typeparam>
        /// <param name="childToAdd">The child itself</param>
        /// <param name="load">A flag to indicate whether we wish to call LoadContent on the child</param>
        /// <param name="initialise">A flag to indicate whether we wish to call Initialise on the child</param>
        /// <returns></returns>
        public virtual K AddChild <K>(K childToAdd, bool load = false, bool initialise = false) where K : T
        {
            if (load)
            {
                childToAdd.LoadContent();
            }

            if (initialise)
            {
                childToAdd.Initialise();
            }

            ObjectsToAdd.Add(childToAdd);

            return(childToAdd);
        }
Ejemplo n.º 3
0
        public virtual void AddObject(T objectToAdd, string tag, bool load = false, bool linkWithObject = true)
        {
            if (load)
            {
                objectToAdd.LoadContent();
                objectToAdd.Initialize();
            }

            objectToAdd.Tag = tag;

            if (linkWithObject)
            {
                objectToAdd.ParentObjectManager = this as BaseObjectManager <BaseObject>;
            }

            ObjectsToAdd.Add(tag, objectToAdd);
        }