/// <summary> /// Adds a new layer in the foreground. /// </summary> /// <returns>The index of the created layer</returns> public Layer NewLayer() { Layer newLayer = new Layer(); PutLayer(newLayer, appendZ); return newLayer; }
public void PutLayer(Layer layer, int z) { layers.Add(z, layer); if (z >= appendZ) { appendZ = z + 1; } }
/// <summary> /// Adds a new layer at the specified index /// </summary> /// <param name="z">The z-position where the layer is to be added.</param> public Layer NewLayer(int z) { Layer newLayer = new Layer(); PutLayer(newLayer, z); return newLayer; }
/// <summary> /// Updates every layer owned by this map /// </summary> /// <param name="gameTime">The amount of time </param> public void Update(GameTime gameTime) { foreach (Layer l in layers.Values) { activeLayer = l; l.Update(gameTime); } }
/// <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; }