TouchyTickets/ThemeParkClicker/Attractions/Attraction.cs
2020-05-31 00:44:15 +02:00

42 lines
1.5 KiB
C#

using System.Collections.Generic;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Startup;
using MLEM.Textures;
namespace ThemeParkClicker.Attractions {
public class Attraction {
public static readonly Dictionary<string, Constructor> Attractions = new Dictionary<string, Constructor>();
public static readonly UniformTextureAtlas Texture = new UniformTextureAtlas(MlemGame.LoadContent<Texture2D>("Textures/Attractions"), 16, 16);
static Attraction() {
Attractions.Add("Carousel", () => new Attraction(new[,] {{true}}, Texture[0, 0, 1, 1], 0.25F, 50));
Attractions.Add("FoodCourt", () => new Attraction(new[,] {{true, true}}, Texture[1, 0, 2, 1], 0.6F, 300));
}
private readonly bool[,] area;
public int Width => this.area.GetLength(0);
public int Height => this.area.GetLength(1);
public readonly TextureRegion TextureRegion;
public readonly float GenerationPerSecond;
public readonly long InitialPrice;
public Attraction(bool[,] area, TextureRegion texture, float generationPerSecond, long initialPrice) {
this.area = area;
this.TextureRegion = texture;
this.GenerationPerSecond = generationPerSecond;
this.InitialPrice = initialPrice;
}
public bool HasTileAt(int x, int y) {
return this.area[y, x];
}
public delegate Attraction Constructor();
public long GetPrice() {
return this.InitialPrice;
}
}
}