void HandleUserInput() { if (_gameState == GameState.Global_LevelScene) { // Look Action if (Input.GetMouseButtonDown(0)) { var mPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); mPos.x += 0.5f; mPos.y += 0.5f; var tilePos = _groundMap.map.WorldToCell(mPos); ReportObjectsAtPosition(new CellPosition(tilePos)); } HandleMovementKeys(); if (Input.GetKeyDown(KeyCode.G)) { // Pickup! var action = new PickupItemAction(_player.actor); _player.actor.SetNextAction(action); } if (Input.GetKeyDown(KeyCode.I)) { TransitionFrom(_gameState); TransitionTo(GameState.Global_InventoryMenu); // Open inventory of player _log.AddMessage(new Message($"{_player.actor.entity.GetColoredName()} opens their inventory...", null)); var result = inventoryInterface.DescribeInventory(); ProcessTurnResults(result); } } else if (_gameState == GameState.Global_InventoryMenu) { if (Input.GetKeyDown(KeyCode.I)) { TransitionFrom(_gameState); TransitionTo(GameState.Global_LevelScene); } } }
/// <summary> /// Initializes a new instance of the <see cref="PickupItemHandler"/> class. /// </summary> /// <param name="gameContext">The game context.</param> public PickupItemHandler(IGameContext gameContext) { this.pickupAction = new PickupItemAction(gameContext); }
/// <summary> /// Initializes a new instance of the <see cref="PickupItemHandler"/> class. /// </summary> public PickupItemHandler() { this.pickupAction = new PickupItemAction(); }