/// <summary> /// Updates the controller /// </summary> internal void Update() { InputState inputState = gameInput.GetState(); GameScreen.gameState = model.events.Count > 0 ? GameState.Event : GameState.Exploration; if (GameScreen.gameState == GameState.Exploration) { if (!inputState.IsKeyDown(InputButton.B) && lastState.IsKeyDown(InputButton.B)) { Game.GoToScreen(Game.pauseMenuScreen); } if (!inputState.IsKeyDown(InputButton.A) && lastState.IsKeyDown(InputButton.A)) { // Find the target of the A action WorldObject target = model.level.GetTarget(model.level.Avatar); if (target != null) { // Do a target specific action if (target is NPC) { UpdateNPC(target as NPC); } else if (target is Item) { UpdateItem(target as Item); } else if (target is Container) { UpdateContainer(target as Container); } else if (target is Door) { UpdateDoor(target as Door); } else { UpdateWorldObject(target); } } } } if (GameScreen.gameState == GameState.Event) { EventBase levelEvent = model.events[0]; if (levelEvent.IsComplete()) { levelEvent.Reset(); gameDialogue.Clear(); model.events.RemoveAt(0); } else { levelEvent.Update(this); } } lastState = inputState; }