Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 2
0
        private void ShowShopItemDialogues()
        {
            _shopItems.Clear();
            string[] shopItemDescriptions = new string[3];

            HashSet <PlayerModifierTypes.ShopItem> currentShopItems = new HashSet <PlayerModifierTypes.ShopItem>();

            for (int i = 0; i < shopItemDescriptions.Length; i++)
            {
                PlayerModifierTypes.ShopItem shopItem = PlayerModifierTypes.GetRandomShopItem();
                while (currentShopItems.Contains(shopItem))
                {
                    shopItem = PlayerModifierTypes.GetRandomShopItem();
                }

                _shopItems.Add(shopItem);
                currentShopItems.Add(shopItem);

                shopItemDescriptions[i] = PlayerModifierTypes.GetShopItemDescription(shopItem);
            }

            DialogueUiManager.instance.DisplayMultiDialogue(shopItemDescriptions);
        }
Exemplo n.º 3
0
        private void HandleSacrificialItemPlayerInteraction()
        {
            PlayerModifierTypes.SacrificialItemInfo?itemInfo = null;

            if (Input.IsActionJustPressed(SceneControls.DialogueControl_1))
            {
                itemInfo = PlayerModifierTypes.GetSacrificialItemAffecter(_sacrificialItems[0]);
            }
            else if (Input.IsActionJustPressed(SceneControls.DialogueControl_2))
            {
                itemInfo = PlayerModifierTypes.GetSacrificialItemAffecter(_sacrificialItems[1]);
            }
            else if (Input.IsActionJustPressed(SceneControls.DialogueControl_3))
            {
                itemInfo = PlayerModifierTypes.GetSacrificialItemAffecter(_sacrificialItems[2]);
            }

            if (itemInfo.HasValue)
            {
                _playerController.HandleSacrificialItemInfluence(itemInfo.Value);
                _parentGroup.SetPlayerAsHostile();
                SetPlayerInteractionState(PlayerInteractionState.Ending);
            }
        }