public void ShowSelection(Animal animal) { if (SelectedSprite.Parent != null) SelectedSprite.Detach(); SelectedSprite.SetTexture(Assets.GetTextureCollection("animals_white")[(int)animal.Species]); SelectedSprite.Scale = animal.Sprite.Scale; SelectedSprite.SetAlpha(1.0F); animal.Sprite.AddChild(SelectedSprite); }
public void DropAnimal(Animal animal, int y) { var sprite = CreateAnimalSprite(animal, animal.X, y); AnimalLayer.AddChild(sprite); animal.SetSprite(sprite); animal.Sprite.SetAlpha(0.0F); }
private Rectangle GetAnimalRectangle(Animal animal) { return new Rectangle((int)AnimalLayer.Position.X + (animal.X * TileSize.X), (int)AnimalLayer.Position.Y + (animal.Y * TileSize.Y), TileSize.X, TileSize.Y); }
private Sprite CreateAnimalSprite(Animal animal, int x, int y) { var texture = Assets.GetTextureCollection("animals")[(int)animal.Species]; return new Sprite(texture, 0.21875F) { LocalPosition = new Vector2((x * TileSize.X) + (TileSize.X / 2.0F), (y * TileSize.Y) + (TileSize.Y / 2.0F)) }; }
public void Add(Animal animal) => _animals.Add(animal);