protected override void SetPrivates() { base.SetPrivates(); CanGoPreviousScene = false; Soul = PlayerPrefsHelper.GetSoul(); _nbCharChoice = Soul.GetStatCurrentValue(Soul.SoulStats[Soul.NbCharChoice_Id]); _choices = new List <Character>(); var maxStartingLevel = Soul.GetStatCurrentValue(Soul.SoulStats[Soul.StartingLevel_Id]); var minStartingLevel = maxStartingLevel - 2 > 1 ? maxStartingLevel - 2 : 1; for (int i = 0; i < _nbCharChoice; ++i) { var tmpChoice = RacesData.GetCharacterFromRaceAndLevel((CharacterRace)Random.Range(0, Helper.EnumCount <CharacterRace>()), Random.Range(minStartingLevel, maxStartingLevel + 1), isPlayer: true); tmpChoice.RunAwayPercent += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.RunAwayPercent_Id]); tmpChoice.LootPercent += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.LootPercent_Id]); tmpChoice.CritChancePercent += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.CritChance_Id]); tmpChoice.InventoryPlace += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.InvPlace_Id]); tmpChoice.InventoryPlace = tmpChoice.InventoryPlace > 6 ? 6 : tmpChoice.InventoryPlace; tmpChoice.WeightLimit += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.InvWeight_Id]); tmpChoice.Gold += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.Gold_Id]); tmpChoice.HpMax += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.Health_Id]); tmpChoice.Hp = Helper.RandomIntMultipleOf(tmpChoice.HpMax / 2, tmpChoice.HpMax, 10); tmpChoice.PmMax += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.Pm_Id]); tmpChoice.PaMax += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.Pa_Id]); _choices.Add(tmpChoice); } Soul.XpKept = (int)(Soul.Xp * Helper.MultiplierFromPercent(0, Soul.GetStatCurrentValue(Soul.SoulStats[Soul.XpKeptPercent_Id]))); Soul.Xp = 0; _skinContainerBhv = GameObject.Find("SkinContainer").GetComponent <SkinContainerBhv>(); _choiceSelector = GameObject.Find("ChoiceSelector"); _characterFrame = GameObject.Find("CharacterFrame"); _playerChoice = _choices[0]; }
private void UpdateView() { foreach (var tab in _tabs) { tab.transform.position = _resetTabPosition; } if (_items.Count > 0) { var id = int.Parse(Constants.LastEndActionClickedName[Helper.CharacterAfterString(Constants.LastEndActionClickedName, "SlotBack")].ToString()); _selectedItem = id < _items.Count ? id : _items.Count - 1; _selectedSprite.transform.position = transform.Find("SlotBack" + _selectedItem).transform.position; var item = _items[_selectedItem]; switch (item.InventoryItemType) { case InventoryItemType.Weapon: DisplayStatsWeapon(_tabs[0], (Weapon)item, "SkinContainerWeapon", "StatsListWeapon"); _tabs[0].transform.position = _currentTabPosition; break; case InventoryItemType.Skill: DisplayStatsSkill(_tabs[1], (Skill)item, "SkinContainerSkill", "StatsListSkill"); _tabs[1].transform.position = _currentTabPosition; break; case InventoryItemType.Item: DisplayStatsItem(_tabs[2], (Item)item, "SkinContainerItem", "StatsListItem"); _tabs[2].transform.position = _currentTabPosition; break; } _priceText.transform.position = _buttonPriceNPositivePosition[0]; _buttonPositive.transform.position = _buttonPriceNPositivePosition[1]; _currentPrice = item.GetPrice(_character, _isBuying, _alignment, _soul.GetStatCurrentValue(Soul.SoulStats[_soul.MerchantDeal_Id])); _priceText.text = _currentPrice + " " + Constants.UnitGold; _buttonPositiveText.text = _isBuying ? "Purchase" : "Sell"; } else //Inventory Empty { _priceText.transform.position = _resetTabPosition; _buttonPositive.transform.position = _resetTabPosition; _selectedSprite.transform.position = _resetTabPosition; } _playerGoldText.text = _character.Gold + " " + Constants.UnitGold; var content = _character.GetTotalWeight() + "/" + _character.WeightLimit; if (_character.GetTotalWeight() <= _character.WeightLimit) { _weightText.text = "<material=\"LongWhite\">" + content + "</material>"; } else { _weightText.text = "<material=\"LongRed\">" + content + "</material>"; } }