Terrain now takes an IsHarmful param in constructor.
This commit is contained in:
parent
f756780660
commit
b2583677bf
@ -28,7 +28,7 @@ namespace SemiColinGames {
|
||||
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);
|
||||
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);
|
||||
@ -54,16 +54,16 @@ namespace SemiColinGames {
|
||||
public TextureRef Texture { get; private set; }
|
||||
public Rectangle TextureSource { get; private set; }
|
||||
|
||||
private Terrain(char symbol, bool isObstacle, TextureRef texture, int x, int y) {
|
||||
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) {
|
||||
if (mapping.ContainsKey(symbol)) {
|
||||
throw new ArgumentException("already have a terrain with symbol " + symbol);
|
||||
}
|
||||
mapping[symbol] = this;
|
||||
IsObstacle = isObstacle;
|
||||
// TODO: don't hard-code just the one spike.
|
||||
if (symbol == '^') {
|
||||
IsHarmful = true;
|
||||
}
|
||||
IsHarmful = isHarmful;
|
||||
Texture = texture;
|
||||
int size = World.TileSize;
|
||||
TextureSource = new Rectangle(x * size, y * size, size, size);
|
||||
|
Loading…
Reference in New Issue
Block a user