Пример #1
0
    protected void UpdateUiInfo()
    {
        //set the ability icons
        if (active_unit == null)
        {
            return;
        }
        AbilityIcons[0].texture = active_unit.GetAbility(0).GetIcon();
        AbilityIcons[1].texture = active_unit.GetAbility(1).GetIcon();
        AbilityIcons[2].texture = active_unit.GetAbility(2).GetIcon();
        AbilityIcons[3].texture = active_unit.GetAbility(3).GetIcon();
        //update the health bar
        health_text.text = (int)active_unit.GetHp() + "/" + (int)active_unit.GetMaxHp() + " + " + (int)(active_unit.GetHpRegen() + active_unit.GetAddedHpRegen());
        hp_bar.rectTransform.sizeDelta = new Vector2(health_bar_length * active_unit.GetHp() / active_unit.GetMaxHp(), hp_bar.rectTransform.sizeDelta.y);
        //update the mana bar
        mana_text.text = (int)active_unit.GetMana() + "/" + (int)active_unit.GetMaxMana() + " + " + (int)(active_unit.GetManaRegen() + active_unit.GetAddedManaRegen());
        mana_bar.rectTransform.sizeDelta = new Vector2(mana_bar_length * active_unit.GetMana() / active_unit.GetMaxMana(), mana_bar.rectTransform.sizeDelta.y);

        //update gold text
        gold_text.text = "Gold: " + player_script.GetGold();

        //get pther stats
        StringBuilder str = new StringBuilder();

        str.Append("Strength: " + active_unit.GetStrength() + "\n");
        str.Append("Agility: " + active_unit.GetAgility() + "\n");
        str.Append("Intelligence: " + active_unit.GetIntelligence() + "\n");
        str.Append("Attack damage: " + (int)active_unit.GetBaseDamage() + " + " + (int)active_unit.GetAddedDamage() + "\n");
        str.Append("Attack speed: " + (int)active_unit.GetAttackSpeed() + " + " + (int)active_unit.GetAddedAttackSpeed() + " Total Attack Time:  " + active_unit.GetAttackTime() + "\n");
        str.Append("Move speed: " + (int)active_unit.GetMovespeed() + " + " + (int)active_unit.GetAddedMovespeed() + "\n");
        str.Append("Ability amp: " + active_unit.GetSpellamp() + " + " + active_unit.GetAddedSpellAmp() + "\n");
        stat_text.text = str.ToString();
        //display the amount of skill points
        SkillPointText.text = "Skill points: " + active_unit.GetSkillPoints();
        //set the level text
        LevelText.text = "Level: " + active_unit.GetLevel();

        //set the lives text
        LivesText.text = "X" + player_script.GetLives();

        //update the cooldowns
        UpdateCooldowns();

        //update the extra stats text
        str.Clear();
        str.Append("Armor: " + active_unit.GetBaseArmor() + "+" + active_unit.GetAddedArmor());
        str.Append("\nMagic resistance: " + active_unit.GetMagicResist());
        str.Append("\nCastspeed reduction: " + active_unit.GetCastSpeedReduction());
        str.Append("\nCooldown reduction: " + active_unit.GetCooldownReduction());
        str.Append("\nCast range: " + active_unit.GetCastRange());
        str.Append("\nSpell lifesteal: " + active_unit.GetSpellLifesteal());
        str.Append("\nLifesteal: " + active_unit.GetLifesteal());
        str.Append("\n Attack range: " + active_unit.GetAttackRange());
        str.Append("\n Pure damage: " + active_unit.GetPureDamage());
        str.Append("\n Splash damage: " + active_unit.GetSplash());
        str.Append("\n Cleave damage: " + active_unit.GetCleave());
        str.Append("\n Crit damage: " + active_unit.GetCriticalDamage());
        str.Append("\n Crit chance: " + active_unit.GetCriticalChance());
        str.Append("\n Status resist: " + active_unit.GetStatusResist());

        ExtraStatsText.text = str.ToString();


        //check to see if the player has clicked on a level
        if (Input.GetMouseButtonDown(0) && leveling_mode)
        {
            //check to see if the ability can be leveled
            for (int i = 0; i < AbilityIcons.Length; i++)
            {
                if (AbilityIcons[i].GetComponent <MouseOverDetector>().MouseIsOver() && active_unit.GetAbility(i).CanLevel())
                {
                    active_unit.GetAbility(i).Level();
                    level_indicators[i][active_unit.GetAbility(i).GetLevel() - 1].texture = LeveledTexture;
                    //reduce the ability points
                    active_unit.AddSkillPoints(-1);
                    ExitLevelStatus();
                }
            }
        }

        //update the level objective text
        LevelObjectiveText.text = level_manager.GetLevelManager().GetDescription();
    }