Ejemplo n.º 1
0
        /// <summary>
        /// Removes an object from this layer
        /// </summary>
        /// <param name="removedObject">The IGameObjectProvider to be removed</param>
        /// <returns>True if the object was removed, false if it was not found</returns>
        internal override bool Remove(GameObject removedObject)
        {
            bool result = false;

            foreach (KeyValuePair<string, GameObject> kvp in widgets)
            {
                if (kvp.Value == removedObject)
                {
                    widgets.Remove(kvp.Key);
                    result = true;
                }
            }

            return result;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Removes an object from this layer
 /// </summary>
 /// <param name="removedObject">The IGameObjectProvider to be removed</param>
 /// <returns>True if the object was removed, false if it was not found</returns>
 public virtual bool Remove(GameObject removedObject)
 {
     return gameObjectList.Remove(removedObject);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Moves an actor to another layer
 /// </summary>
 /// <param name="movedActor">The actor to be moved</param>
 /// <param name="destinationLayer">The layer to move the actor to</param>
 /// <returns>True if the operation was successful, otherwise false</returns>
 public bool MoveTo(GameObject movedObject, Layer destinationLayer)
 {
     bool result = Remove(movedObject);
     if (result) destinationLayer.Add(movedObject);
     return result;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds a GameObject to this layer
 /// </summary>
 /// <param name="addedObject">The added GameObject</param>
 public virtual void Add(GameObject addedObject)
 {
     gameObjectList.Add(addedObject);
 }
Ejemplo n.º 5
0
 private string GenerateDefaultName(GameObject gameObject)
 {
     return String.Format("{0}_{1}", gameObject.GetType().ToString(), gameObject.GetHashCode());
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Adds a GameObject to this layer
 /// </summary>
 /// <param name="addedObject">The added IGameObjectProvider</param>
 public override void Add(GameObject addedObject)
 {
     widgets.Add(GenerateDefaultName(addedObject), addedObject);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Removes an object from this layer
 /// </summary>
 /// <param name="removedObject">The IGameObjectProvider to be removed</param>
 /// <returns>True if the object was removed, false if it was not found</returns>
 internal virtual bool Remove(GameObject removedObject)
 {
     return gameObjectList.Remove(removedObject);
 }