World: convert fields to properties
GitOrigin-RevId: 7b0552c278cfe48e66e806ff94106617bf834252
This commit is contained in:
parent
84fa044675
commit
e6fa78e30f
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user