public Person(Vector2 position, World w) { this.id = currId++; this.position = position; this.personality = new Personality(); this.relationships = new List<Relationship>(); this.hobbies = new List<Hobby>(); generateHobbies(hobbies); this.color = Color.Black; this.bubble = new Bubble(hobbies.First<Hobby>().id); this.dir = w.getValidDir(this.position); this.currentTile = w.getTiles(this.position).First<Tile>(); }
public void update(World w) { this.position += dir; List<Tile> thing = w.getTiles(this.position); if (!thing.Contains(this.currentTile)) { if (thing.Count > 0) { this.currentTile = thing.First<Tile>(); } else { this.dir = Vector2.Zero; } if (this.currentTile.intersection) { this.dir = w.getValidDir(this.position); } } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); Tile.setTexture(Content.Load<Texture2D>("tile")); Person.setTexture(Content.Load<Texture2D>("person")); Bubble.setTexture(Content.Load<Texture2D>("bubble")); Texture2D[] hobbies = new Texture2D[8]; for (int i = 0; i < 8; i++) { hobbies[i] = Content.Load<Texture2D>("hobby" + i); } Hobby.textures = hobbies; this.cam = new Camera2D(GraphicsDevice.Viewport); cam.Zoom = .25f; this.world = new World(); people = new List<Person>(); populate(people); // TODO: use this.Content to load your game content here }