using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; class House { private Rectangle housePos; private Vector2 pos; private Random r = new Random(); public void init(int tileSize, int Spacing) { int x = r.Next(0, 8); int y = r.Next(0, 8); pos = new Vector2(x, y); housePos = new Rectangle((x * tileSize + Spacing), y * (tileSize + Spacing), tileSize, tileSize); } public void updateRectangle(Vector2 Size, int tileSize) { if (pos.X + 1 > Size.X) { pos = new Vector2(pos.X - 1, pos.Y); } if (pos.Y + 1 > Size.Y) { pos = new Vector2(pos.X, pos.Y - 1); } housePos = new Rectangle((int)pos.X * (tileSize + 1), (int)pos.Y * (tileSize + 1), tileSize, tileSize); } public Rectangle GetRectangle() { return housePos; } public Vector2 getVector() { return new Vector2(housePos.X, housePos.Y); } }