Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        DefendDefense         = 0;
        EnemyDefendDefense    = 0;
        EnemyBarFill          = EnemyHealthBar.GetComponent <Image>();
        PlayerBarFill         = PlayerHealthBar.GetComponent <Image>();
        EnemySignatureCharges = Random.Range(1, 2);
        State      = States.Idle;
        PlayerTurn = true;

        playerDefense = PlayerPrefs.GetFloat("_Defense");
        Abilities[0]  = PlayerPrefs.GetInt("Ability_1");
        Abilities[1]  = PlayerPrefs.GetInt("Ability_2");
        Abilities[2]  = PlayerPrefs.GetInt("Ability_3");
        Abilities[3]  = PlayerPrefs.GetInt("Ability_4");

        if (Abilities[1] == 0)
        {
            Abilities[1] = 1;
        }
        if (Abilities[2] == 0)
        {
            Abilities[2] = 2;
        }
        if (Abilities[3] == 0)
        {
            Abilities[3] = 3;
        }

        PlayerAbilities[0] = AbilityList.Abilities[Abilities[0]];
        PlayerAbilities[1] = AbilityList.Abilities[Abilities[1]];
        PlayerAbilities[2] = AbilityList.Abilities[Abilities[2]];
        PlayerAbilities[3] = AbilityList.Abilities[Abilities[3]];

        _Ability1.GetComponentInChildren <TextMeshProUGUI>().text  = PlayerAbilities[0].ButtonText;
        _Ability1.GetComponentInChildren <TextMeshProUGUI>().color = PlayerAbilities[0].ButtonTextColor;
        _Ability2.GetComponentInChildren <TextMeshProUGUI>().text  = PlayerAbilities[1].ButtonText;
        _Ability2.GetComponentInChildren <TextMeshProUGUI>().color = PlayerAbilities[1].ButtonTextColor;
        _Ability3.GetComponentInChildren <TextMeshProUGUI>().text  = PlayerAbilities[2].ButtonText;
        _Ability3.GetComponentInChildren <TextMeshProUGUI>().color = PlayerAbilities[2].ButtonTextColor;
        _Ability4.GetComponentInChildren <TextMeshProUGUI>().text  = PlayerAbilities[3].ButtonText;
        _Ability4.GetComponentInChildren <TextMeshProUGUI>().color = PlayerAbilities[3].ButtonTextColor;

        int i = Random.Range(0, EnemyList.EnemyList.Length);

        StartingEnemy = EnemyList.EnemyList[i];
        EnemyTitle.GetComponent <TextMeshProUGUI>().text           = StartingEnemy.Name;
        EnemyTitle.GetComponent <TextMeshProUGUI>().color          = StartingEnemy.NameColor;
        _Enemy.GetComponent <Animator>().runtimeAnimatorController = StartingEnemy.DefaultAnimation;
        DefaultEnemyAnimation = StartingEnemy.DefaultAnimation;
        EnemyAbilities[0]     = StartingEnemy.BasicAttack;
        EnemyAbilities[1]     = StartingEnemy.DefenseAbility;
        EnemyAbilities[2]     = StartingEnemy.UtilityAbility;
        EnemyAbilities[3]     = StartingEnemy.SignatureAbility;
    }