public override void Update(Input input) { base.Update(input); if (creationState == CreationState.WaitingForPerlin) { UpdateWaitPerlin(); } else if (creationState == CreationState.StartCreatingWorld) { ThreadPool.QueueUserWorkItem(UpdateCreatingWorld); creationState = CreationState.CreatingWorld; } else if (creationState == CreationState.InitMiniMap) { UpdateInitMiniMap(); } else if (creationState == CreationState.CreatingMiniMap) { UpdateCreatingMiniMap(); } else if (creationState == CreationState.Done) { ScreenController.ChangeScreen(new GameScreen()); } }
public override void Update(Input input) { base.Update(input); if (GetButtonPress("New")) { SetSeed(); ScreenController.ChangeScreen(new CreatingWorld(GetWorldSize().X, GetWorldSize().Y, GetNumberOfTowns(), GetMinTownRoads(), GetMaxTownRoads())); } }
public override void Update(Input input) { debugMainThreadStopWatch.Start(); base.Update(input); SetSecondThreadUpdateState(UpdateState.START); UpdateKeys(input); if (GameController.inGameState == InGameState.RUNNING) { //Run main Update WorldController.world.Update(input, mainWorldCamera); WorldController.worldMini.Update(); UpdateInGameMouseClicks(); debugMainThreadStopWatch.Stop(); while (secondThreadState != UpdateState.FINISHED) { //Wait for other thread } //Other thread is finished we can add any fires on the main thread WorldController.worldFire.UpdateThreadedFireSpreading(); } else if (GameController.inGameState == InGameState.WAITINGONEXIT) { secondThreadRunning = false; GameController.jobWorker.SetToDestroy(); GameController.inGameState = InGameState.SETTINGEXIT; } else if (GameController.inGameState == InGameState.SETTINGEXIT) { if (GameController.jobWorker.IsDestroyed()) { GameController.jobWorker = null; GameController.inGameState = InGameState.EXIT; } } else if (GameController.inGameState == InGameState.EXIT) { WorldController.DisposeWorld(); ScreenController.ChangeScreen(new MenuMain()); } EngineController.mainThreadTime = debugMainThreadStopWatch.ElapsedTicks; debugMainThreadStopWatch.Reset(); }
protected override void Initialize() { debugDrawTimeStopwatch = new Stopwatch(); // Window.IsBorderless = false; Data.SetSettings(); ScreenController.graphicsDevice = GraphicsDevice; DisplayController.Init(this); EngineController.Init(); GraphicsManager.Init(Content); AudioManager.Init(Content); //Game specific init. this could probably be done in game load GroundLayerController.Init(); AngleStuff.Init(); PieceController.Init(); ShadowSpriteController.Init(); MapObjectController.Init(); TileLogisticsController.Init(); GraphicsDevice.Clear(Color.White); IsMouseVisible = true; base.Initialize(); ScreenController.ChangeScreen(new MenuMain()); }
public override void Update(Input input) { //Debug.WriteLine(compressedBuilding.shadowList.Count); base.Update(input); UpdateEditingMode(); general.UpdateDisplayLocations(editorView.activeSpot, editorView.offSet); if (GetButtonPress("Save")) { buildingsBinary.AddBuilding(editorView.compressedBuilding); } if (input.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.Escape) && !GameController.editorInMenu) { AddContainer(new MenuBarInGame()); } if (GameController.inGameState == InGameState.WAITINGONEXIT) { ScreenController.ChangeScreen(new MenuMain()); } }
public override void Update(Input input) { base.Update(input); if (GetButtonPress("New")) { EditorParams editorParams = new EditorParams(); CompressedBuilding building = new CompressedBuilding(GetHousePieceRow(), GetDirectionFacing(), editorParams); building.InitNew(buildingsBinary.GetNextId()); ScreenController.ChangeScreen(new BuildingScreen(building, buildingsBinary, editorParams)); } if (GetButtonPress("Load")) { CompressedBuilding building = (CompressedBuilding)listBoxBuildings.GetSelectedObjectValue(); if (building != null) { EditorParams editorParams = new EditorParams(); building.InitOld(editorParams); ScreenController.ChangeScreen(new BuildingScreen(building, buildingsBinary, editorParams)); } } }