Beispiel #1
0
        private void HandleShopPlayerInteraction()
        {
            PlayerModifierTypes.ShopItemInfo?shopItemInfo = null;

            if (Input.IsActionJustPressed(SceneControls.DialogueControl_1))
            {
                shopItemInfo = PlayerModifierTypes.GetShopItem(_shopItems[0]);
            }
            else if (Input.IsActionJustPressed(SceneControls.DialogueControl_2))
            {
                shopItemInfo = PlayerModifierTypes.GetShopItem(_shopItems[1]);
            }
            else if (Input.IsActionJustPressed(SceneControls.DialogueControl_3))
            {
                shopItemInfo = PlayerModifierTypes.GetShopItem(_shopItems[2]);
            }
            else if (Input.IsActionJustPressed(SceneControls.Cancel))
            {
                ResetPlayerAndDialogues();
                SetPlayerInteractionState(PlayerInteractionState.NotActive);
                _playerIsInside = false;
            }

            if (shopItemInfo.HasValue)
            {
                int soulsCost = PlayerModifierTypes.GetShopItemCost(shopItemInfo.Value.shopItem);

                if (PlayerModifierSoulsManager.instance.GetSoulsCount() >= soulsCost)
                {
                    PlayerModifierSoulsManager.instance.DecrementSouls(soulsCost);
                    _playerController.HandleShopItemInfluence(shopItemInfo.Value);
                    _parentGroup.SetPlayerAsHostile();
                    SetPlayerInteractionState(PlayerInteractionState.Ending);
                }
                else
                {
                    ResetPlayerAndDialogues();
                    DialogueUiManager.instance.DisplaySingleStringTimed("Not Enough Souls Available", 3);

                    SetPlayerInteractionState(PlayerInteractionState.NotActive);
                    _playerIsInside = false;
                }
            }
        }