Ejemplo n.º 1
0
        private void ShowAndApplyBasePerk()
        {
            var availablePerks = PerksList
                                 .Where(p =>
            {
                var perk = p.GetComponent <PerkUpgradeBase>();

                return(perk != null && !perk.GetType().IsSubclassOf(typeof(PerkUpgradeBase)));
            }).ToList();

            foreach (var go in availablePerks)
            {
                var perk = go.GetComponent <PerkUpgradeBase>();

                var button = Instantiate(cheatButtonTemplate, content.transform);
                var btn    = button.GetComponent <CheatButton>();
                btn.ButtonAction = () =>
                {
                    if (ReferenceEquals(PlayerToUi, null))
                    {
                        return;
                    }
                    perk.SpawnPerk(_playerToUi);
                };
                btn.ButtonName = perk.PerkName;
            }
        }
Ejemplo n.º 2
0
        private void ShowAvailableBindablePerks(int perkIndexToChange)
        {
            SetBackButtonAction(CreateChooseBindablePerksButton);

            var availablePerks = PerksList
                                 .Where(p =>
            {
                var bindablePerk = p.GetComponent <BindablePerk>();

                if (bindablePerk == null)
                {
                    return(false);
                }
                var index = bindablePerk.perkPrefab.GetComponent <AbilityAddActionsToPlayerInput>()?.customBinding.index;

                return(index != null && index == perkIndexToChange);
            }).ToList();

            foreach (var go in availablePerks)
            {
                var perk = go.GetComponent <BindablePerk>();

                var button = Instantiate(cheatButtonTemplate, content.transform);
                var btn    = button.GetComponent <CheatButton>();
                btn.ButtonAction = () => ChangeBindablePerk(perkIndexToChange, perk);
                btn.ButtonName   = perk.PerkName;
            }
        }