/// <summary> /// adds an empty image as a child to the main grid of the application /// </summary> private void addSpriteContainer() { Image img = new Image(); img.Width = spriteWidth; img.Height = spriteHeight; img.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; img.VerticalAlignment = System.Windows.VerticalAlignment.Top; Plant tempPlant = new Plant(img, spriteIndexGlobal++); this.FlowerGrid.Children.Add(img); this.availableSpriteContainers.Add(tempPlant); }
/// <summary> /// removes a given plant of the drawing grid and from the list of active plants. /// the plants is hard-removed, meaning not withering ist done. /// if you want to wither a plant, set its IsWithering property to true. /// </summary> /// <param name="plantToRemove"></param> private void removePlant(Plant plantToRemove) { this.FlowerGrid.Children.Remove(plantToRemove.Img); plantToRemove.Img = null; this.activePlants.Remove(plantToRemove); }