コード例 #1
0
ファイル: GameManager.cs プロジェクト: Kinzata/Roguelike2019
    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);
            }
        }
    }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
ファイル: PickupItemHandler.cs プロジェクト: smarotta/OpenMU
 /// <summary>
 /// Initializes a new instance of the <see cref="PickupItemHandler"/> class.
 /// </summary>
 public PickupItemHandler()
 {
     this.pickupAction = new PickupItemAction();
 }