Terrain: use optional arguments for IsObstacle / IsHarmful
This commit is contained in:
parent
b2583677bf
commit
08091106ea
@ -18,46 +18,75 @@ namespace SemiColinGames {
|
||||
|
||||
private readonly static Dictionary<char, Terrain> mapping = new Dictionary<char, Terrain>();
|
||||
|
||||
public static Terrain Empty = new Terrain('\0', false, Textures.Grassland, 0, 0);
|
||||
public static Terrain Grass = new Terrain('=', true, Textures.Grassland, 3, 0);
|
||||
public static Terrain GrassL = new Terrain('<', true, Textures.Grassland, 2, 0);
|
||||
public static Terrain GrassR = new Terrain('>', true, Textures.Grassland, 4, 0);
|
||||
public static Terrain Rock = new Terrain('.', true, Textures.Grassland, 3, 1);
|
||||
public static Terrain RockL = new Terrain('[', true, Textures.Grassland, 1, 2);
|
||||
public static Terrain RockR = new Terrain(']', true, Textures.Grassland, 5, 2);
|
||||
public static Terrain WaterL = new Terrain('~', false, Textures.Grassland, 9, 2);
|
||||
public static Terrain WaterR = new Terrain('`', false, Textures.Grassland, 10, 2);
|
||||
public static Terrain Block = new Terrain('X', true, Textures.Ruins, 2, 0);
|
||||
public static Terrain Spike = new Terrain('^', true, Textures.Grassland, 11, 8, true);
|
||||
public static Terrain Wood = new Terrain('_', true, Textures.Grassland, 10, 3);
|
||||
public static Terrain WoodL = new Terrain('(', true, Textures.Grassland, 9, 3);
|
||||
public static Terrain WoodR = new Terrain(')', true, Textures.Grassland, 12, 3);
|
||||
public static Terrain WoodVert = new Terrain('|', false, Textures.Grassland, 9, 5);
|
||||
public static Terrain WoodVertL = new Terrain('/', false, Textures.Grassland, 9, 4);
|
||||
public static Terrain WoodVertR = new Terrain('\\', false, Textures.Grassland, 12, 4);
|
||||
public static Terrain WoodBottom = new Terrain('v', false, Textures.Grassland, 10, 5);
|
||||
public static Terrain FenceL = new Terrain('d', false, Textures.Grassland, 5, 4);
|
||||
public static Terrain Fence = new Terrain('f', false, Textures.Grassland, 6, 4);
|
||||
public static Terrain FencePost = new Terrain('x', false, Textures.Grassland, 7, 4);
|
||||
public static Terrain FenceR = new Terrain('b', false, Textures.Grassland, 8, 4);
|
||||
public static Terrain VineTop = new Terrain('{', false, Textures.Ruins, 12, 5);
|
||||
public static Terrain VineMid = new Terrain(';', false, Textures.Ruins, 12, 6);
|
||||
public static Terrain VineBottom = new Terrain('}', false, Textures.Ruins, 12, 7);
|
||||
public static Terrain GrassTall = new Terrain('q', false, Textures.Grassland, 13, 0);
|
||||
public static Terrain GrassShort = new Terrain('w', false, Textures.Grassland, 14, 0);
|
||||
public static Terrain Shoots = new Terrain('e', false, Textures.Grassland, 15, 0);
|
||||
public static Terrain Bush = new Terrain('r', false, Textures.Grassland, 13, 2);
|
||||
public static Terrain Mushroom = new Terrain('t', false, Textures.Grassland, 17, 2);
|
||||
public static Terrain Empty =
|
||||
new Terrain('\0', Textures.Grassland, 0, 0);
|
||||
public static Terrain Spike =
|
||||
new Terrain('^', Textures.Grassland, 11, 8, isObstacle: true, isHarmful: true);
|
||||
public static Terrain Grass =
|
||||
new Terrain('=', Textures.Grassland, 3, 0, isObstacle: true);
|
||||
public static Terrain GrassL =
|
||||
new Terrain('<', Textures.Grassland, 2, 0, isObstacle: true);
|
||||
public static Terrain GrassR =
|
||||
new Terrain('>', Textures.Grassland, 4, 0, isObstacle: true);
|
||||
public static Terrain Rock =
|
||||
new Terrain('.', Textures.Grassland, 3, 1, isObstacle: true);
|
||||
public static Terrain RockL =
|
||||
new Terrain('[', Textures.Grassland, 1, 2, isObstacle: true);
|
||||
public static Terrain RockR =
|
||||
new Terrain(']', Textures.Grassland, 5, 2, isObstacle: true);
|
||||
public static Terrain Block =
|
||||
new Terrain('X', Textures.Ruins, 2, 0, isObstacle: true);
|
||||
public static Terrain Wood =
|
||||
new Terrain('_', Textures.Grassland, 10, 3, isObstacle: true);
|
||||
public static Terrain WoodL =
|
||||
new Terrain('(', Textures.Grassland, 9, 3, isObstacle: true);
|
||||
public static Terrain WoodR =
|
||||
new Terrain(')', Textures.Grassland, 12, 3, isObstacle: true);
|
||||
public static Terrain WoodVert =
|
||||
new Terrain('|', Textures.Grassland, 9, 5);
|
||||
public static Terrain WoodVertL =
|
||||
new Terrain('/', Textures.Grassland, 9, 4);
|
||||
public static Terrain WoodVertR =
|
||||
new Terrain('\\', Textures.Grassland, 12, 4);
|
||||
public static Terrain WoodBottom =
|
||||
new Terrain('v', Textures.Grassland, 10, 5);
|
||||
public static Terrain WaterL =
|
||||
new Terrain('~', Textures.Grassland, 9, 2);
|
||||
public static Terrain WaterR =
|
||||
new Terrain('`', Textures.Grassland, 10, 2);
|
||||
public static Terrain FenceL =
|
||||
new Terrain('d', Textures.Grassland, 5, 4);
|
||||
public static Terrain Fence =
|
||||
new Terrain('f', Textures.Grassland, 6, 4);
|
||||
public static Terrain FencePost =
|
||||
new Terrain('x', Textures.Grassland, 7, 4);
|
||||
public static Terrain FenceR =
|
||||
new Terrain('b', Textures.Grassland, 8, 4);
|
||||
public static Terrain VineTop =
|
||||
new Terrain('{', Textures.Ruins, 12, 5);
|
||||
public static Terrain VineMid =
|
||||
new Terrain(';', Textures.Ruins, 12, 6);
|
||||
public static Terrain VineBottom =
|
||||
new Terrain('}', Textures.Ruins, 12, 7);
|
||||
public static Terrain GrassTall =
|
||||
new Terrain('q', Textures.Grassland, 13, 0);
|
||||
public static Terrain GrassShort =
|
||||
new Terrain('w', Textures.Grassland, 14, 0);
|
||||
public static Terrain Shoots =
|
||||
new Terrain('e', Textures.Grassland, 15, 0);
|
||||
public static Terrain Bush =
|
||||
new Terrain('r', Textures.Grassland, 13, 2);
|
||||
public static Terrain Mushroom =
|
||||
new Terrain('t', Textures.Grassland, 17, 2);
|
||||
|
||||
public bool IsObstacle { get; private set; }
|
||||
public bool IsHarmful { get; private set; } = false;
|
||||
public bool IsHarmful { get; private set; }
|
||||
public TextureRef Texture { get; private set; }
|
||||
public Rectangle TextureSource { get; private set; }
|
||||
|
||||
private Terrain(char symbol, bool isObstacle, TextureRef texture, int x, int y) :
|
||||
this(symbol, isObstacle, texture, x, y, false) {}
|
||||
|
||||
private Terrain(char symbol, bool isObstacle, TextureRef texture, int x, int y, bool isHarmful) {
|
||||
private Terrain(
|
||||
char symbol, TextureRef texture, int x, int y,
|
||||
bool isObstacle = false, bool isHarmful = false) {
|
||||
if (mapping.ContainsKey(symbol)) {
|
||||
throw new ArgumentException("already have a terrain with symbol " + symbol);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user