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; } }
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; } }
public void SetValuesInPlayer() { Game.maxDungeonLevel = dungeonLevel; Game.player.name = name; Game.player.attack = attack; Game.player.evasion = evasion; Game.player.blocking = blocking; Game.player.accuracy = accuracy; Game.player.criticalChance = criticalChance; Game.player.currentGold = gold; Game.player.specification.level = level; Game.player.helth = helth; Game.player.maxHelth = maxHelth; Game.player.mana = mana; Game.player.maxMana = maxMana; Game.player.specification.currentExp = currentExp; Game.player.specification.maxExp = maxExp; Game.player.specification.gender = gender; Game.player.specification.specialization = specialization; Game.player.specification.race = race; Game.player.specification.strength = strength; Game.player.specification.agility = agility; Game.player.specification.intelligence = intelligence; Game.player.specification.spellPower = spellPower; Game.player.specification.levelPoint = levelPoint; Game.player.specification.strengthMultiply = strengthMultiply; Game.player.specification.agilityMultiply = agilityMultiply; Game.player.specification.intelligenceMultiply = intelligenceMultiply; Game.player.inventory.activeHelmet = (Helmet)ItemsList.GetItemByName(activeHelmet); Game.player.inventory.activeArmor = (Armor)ItemsList.GetItemByName(activeArmor); Game.player.inventory.activeWeapon = (Weapon)ItemsList.GetItemByName(activeWeapon); for (int i = 0; i < itemsCount; ++i) { Game.player.inventory.items.Add(ItemsList.GetItemByName(itemsName[i])); } for (int i = 0; i < perksCount; ++i) { Game.player.perksSystem.AddPerk(PerksList.GetPerkByPerkValue(perksValue[i])); } for (int i = 0; i < magicCount; ++i) { Game.player.magicSystem.AddSpell(MagicList.GetMagicByName(magicsName[i])); } Game.player.magicSystem.activeMagic = MagicList.GetMagicByName(activeMagicsName); }