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];
    }
 public void SetPrivates(Character character, System.Func <bool> sceneUpdateAction, bool isInventoryAvailable, int tabId)
 {
     _title              = transform.Find("Title").GetComponent <TMPro.TextMeshPro>();
     _character          = character;
     _sceneUpdateAction  = sceneUpdateAction;
     _currentTab         = tabId;
     _resetTabPosition   = new Vector3(-10.0f, 10.0f, 0.0f);
     _currentTabPosition = transform.position;
     _tabs         = new List <GameObject>();
     _buttonsTabs  = new List <ButtonBhv>();
     _instantiator = GameObject.Find(Constants.GoSceneBhvName).GetComponent <SceneBhv>().Instantiator;
     for (int i = 0; i < 5; ++i)
     {
         _tabs.Add(transform.Find("Tab" + i).gameObject);
         _buttonsTabs.Add(transform.Find("ButtonTab" + i).GetComponent <ButtonBhv>());
         if (i == _currentTab)
         {
             BringTabFront(_tabs[i]);
         }
         else
         {
             UnpressButton(_buttonsTabs[i].gameObject);
             BringTabBack(_tabs[i], i);
         }
     }
     _skinContainerBhv = _tabs[0].transform.Find("SkinContainer").GetComponent <SkinContainerBhv>();
     SetButtons(isInventoryAvailable);
     DisplayStatsCharacter();
     DisplayStatsWeapon(_tabs[1], _character.Weapons[0], "SkinContainerWeapon0", "StatsList1");
     DisplayStatsWeapon(_tabs[2], _character.Weapons[1], "SkinContainerWeapon1", "StatsList2");
     DisplayStatsSkill(_tabs[3], _character.Skills[0], "SkinContainerSkill0", "StatsList3");
     DisplayStatsSkill(_tabs[4], _character.Skills[1], "SkinContainerSkill1", "StatsList4");
 }
示例#3
0
    public void SetPrivates()
    {
        _fightSceneBhv = GameObject.Find(Constants.GoSceneBhvName).GetComponent <FightSceneBhv>();
        _gridBhv       = GameObject.Find(Constants.GoSceneBhvName).GetComponent <GridBhv>();
        OpponentBhvs   = new List <CharacterBhv>();
        if (Character.IsPlayer)
        {
            int nbOpponents = PlayerPrefs.GetInt(Constants.PpNbOpponents);
            for (int i = 0; i < nbOpponents; ++i)
            {
                OpponentBhvs.Add(GameObject.Find(Constants.GoOpponentName + i).GetComponent <CharacterBhv>());
            }
        }
        else
        {
            OpponentBhvs.Add(GameObject.Find(Constants.GoPlayerName).GetComponent <CharacterBhv>());
            Ai = gameObject.AddComponent <AiBhv>();
            Ai.SetPrivates();
        }

        Instantiator  = _fightSceneBhv.Instantiator;
        SkinContainer = transform.Find("SkinContainer").GetComponent <SkinContainerBhv>();
        for (int i = 0; i < Character.Skills.Count; ++i)
        {
            if (Character.Skills[i] != null)
            {
                Character.Skills[i].Init(this, OpponentBhvs, _gridBhv, i);
            }
        }
        if (Character.IsPlayer)
        {
            _orbPa = GameObject.Find("Pa")?.GetComponent <OrbBhv>();
            _orbPm = GameObject.Find("Pm")?.GetComponent <OrbBhv>();
        }
        Pa = Character.PaMax;
        Pm = Character.PmMax;
    }