/// <summary> /// Adds a layer to the game state. /// </summary> /// <param name="key">used to reference the added layer in other game objects</param> /// <param name="sortIndex"> /// sort position in reference to the default 0, layers are drawn from lowest to highest /// </param> public Layer Add(string key, int sortIndex) { var layer = new Layer(key, sortIndex); _layers.Add(layer); _layers.Sort((a, b) => a.SortIndex.CompareTo(b.SortIndex)); LayerAdded?.Invoke(this, new LayerAddedEvent(layer)); return layer; }
public LayerAddedEvent(Layer layer) { Layer = layer; }
public LayerManager() { _defaultLayer = new Layer("default", 0); _layers.Add(_defaultLayer); }