/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { IsMouseVisible = true; _pauseMenuTexture = Content.Load <Texture2D>("PauseTexture"); _pauseMenuRectangle = new Rectangle(0, 0, _pauseMenuTexture.Width, _pauseMenuTexture.Height); _cleaner = new Cleaner() { Position = new Vector2(5, 2), VasteLocatie = new Vector2(5, 2) }; _cleaner2 = new Cleaner() { Position = new Vector2(5, 5), VasteLocatie = new Vector2(5, 5) }; // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); _persons = new List <IPerson>(); _cleaners = new List <Cleaner>(); _hotel.Areas = new LayoutReader().GetAllObjects(@"Content\Hotel3.layout"); AreaFactory areaFactory = new AreaFactory(); _elevator = (Elevator)areaFactory.Create("Elevator"); _stairs = (Stairs)areaFactory.Create("Stairs"); _lobby = (Lobby)areaFactory.Create("Lobby"); _elevator.Dimension = new Vector2(1, _hotel.Areas.OrderByDescending(x => x.Dimension.Y + x.Position.Y).First().Dimension.Y + _hotel.Areas.OrderByDescending(x => x.Dimension.Y + x.Position.Y).First().Position.Y); _stairs.Position = new Vector2(_hotel.Areas.OrderByDescending(x => x.Position.X + x.Dimension.X).First().Dimension.X + _hotel.Areas.OrderByDescending(x => x.Position.X + x.Dimension.X).First().Position.X, 0); _stairs.Dimension = new Vector2(1, _hotel.Areas.OrderByDescending(x => x.Dimension.Y + x.Position.Y).First().Dimension.Y + _hotel.Areas.OrderByDescending(x => x.Dimension.Y + x.Position.Y).First().Position.Y); _lobby.Dimension = new Vector2(_stairs.Position.X - 1, 1); _hotel.Areas.Add(_elevator); _hotel.Areas.Add(_stairs); _hotel.Areas.Add(_lobby); _persons.Add(_cleaner); _persons.Add(_cleaner2); _cleaners.Add(_cleaner); _cleaners.Add(_cleaner2); foreach (IArea area in _hotel.Areas) { area.LoadContent(Content); } _hotel.Load(); _hotel.AddToGraph(_simplePath); PeopleFactory peopleFactory = new PeopleFactory(); // nog even uitzoeken waar dit het best kan foreach (IPerson person in _persons) { person.LoadContent(Content); } _elevator.Attach(_cleaner); _elevator.Attach(_cleaner2); _menuForm = new MenuForm(_hotel, _cleaners, _customers, _persons, _stairs, _simplePath); _menuForm.Show(); // TODO: use this.Content to load your game content here }
private void CloseOnClick(object sender, EventArgs e) { this.Hide(); if (cmbHTE_Time.Text != "") { HotelEventManager.HTE_Factor = (float)Math.Pow(2, Convert.ToInt32(cmbHTE_Time.Text) - 1); } if (cmbStairsSpeed.Text != "") { Stairs.Weight = -(Convert.ToInt32(cmbStairsSpeed.Text) - 6); } if (cmbStairsSpeed.Text != "") { SimplePath = new SimplePath(); Hotel.AddToGraph(SimplePath); } if (Movie_Runtime_TXT.Text != "") { int parsedValue; if (int.TryParse(Movie_Runtime_TXT.Text, out parsedValue)) { MovieTime = Convert.ToInt32(string.Join(null, System.Text.RegularExpressions.Regex.Split(Movie_Runtime_TXT.Text, "[^\\d]"))); foreach (Cinema cinema in Hotel.Areas.Where(r => r.AreaType == "Cinema")) { Cinema TempCin = (Cinema)cinema; TempCin.RunTime = MovieTime; } } } if (Eating_Speed_TXT.Text != "") { int parsedValue; if (int.TryParse(Eating_Speed_TXT.Text, out parsedValue)) { EatingSpeed = Convert.ToInt32(string.Join(null, System.Text.RegularExpressions.Regex.Split(Eating_Speed_TXT.Text, "[^\\d]"))); foreach (Restaurant restaurant in Hotel.Areas.Where(r => r.AreaType == "Restaurant")) { Restaurant TempRes = (Restaurant)restaurant; TempRes.EatSpeed = EatingSpeed; } } } if (Cleaning_Speed_TXT.Text != "") { int parsedValue; if (int.TryParse(Cleaning_Speed_TXT.Text, out parsedValue)) { CleanSpeed = Convert.ToInt32(string.Join(null, System.Text.RegularExpressions.Regex.Split(Cleaning_Speed_TXT.Text, "[^\\d]"))); foreach (Cleaner cleaner in Cleaners) { cleaner.CleaningSpeed = CleanSpeed; } } } foreach (IPerson person in Persons) { person.RoundPosition(); } if (!HotelEventManager.Running) { HotelEventManager.Pauze(); } }