|
|
@ -18,22 +18,20 @@ namespace SemiColinGames { |
|
|
|
|
|
|
|
class Tile { |
|
|
|
readonly Texture2D texture; |
|
|
|
readonly Terrain terrain; |
|
|
|
Rectangle position; |
|
|
|
|
|
|
|
public Tile(Texture2D texture, Terrain terrain, Rectangle position) { |
|
|
|
this.texture = texture; |
|
|
|
this.terrain = terrain; |
|
|
|
this.position = position; |
|
|
|
this.Terrain = terrain; |
|
|
|
this.Position = position; |
|
|
|
} |
|
|
|
|
|
|
|
public Rectangle Position { get { return position; } } |
|
|
|
public Terrain Terrain { get { return terrain; } } |
|
|
|
public Rectangle Position { get; private set; } |
|
|
|
public Terrain Terrain { get; private set; } |
|
|
|
|
|
|
|
public void Draw(SpriteBatch spriteBatch, Camera camera) { |
|
|
|
int size = World.TileSize; |
|
|
|
Vector2 drawPos = new Vector2(position.Left - camera.Left, position.Top); |
|
|
|
switch (terrain) { |
|
|
|
Vector2 drawPos = new Vector2(Position.Left - camera.Left, Position.Top); |
|
|
|
switch (Terrain) { |
|
|
|
case Terrain.Grass: { |
|
|
|
Rectangle source = new Rectangle(3 * size, 0 * size, size, size); |
|
|
|
spriteBatch.Draw(texture, drawPos, source, Color.White); |
|
|
|