コード例 #1
0
        private void PrintSelectedUnitStats(UnitStackBase unit)
        {
            DeselectCurrentTarget();
            nameSelectedText.gameObject.SetActive(true);
            numberSelectedText.gameObject.SetActive(true);
            HPSelectedText.gameObject.SetActive(true);
            currentHPSelectedText.gameObject.SetActive(true);
            damageSelectedText.gameObject.SetActive(true);
            initiativeSelectedText.gameObject.SetActive(true);

            nameSelectedText.text       = unit.UnitName;
            numberSelectedText.text     = "Количество " + unit.NumberOfUnits;
            HPSelectedText.text         = "Max HP " + unit.MaxHealth;
            currentHPSelectedText.text  = "Current HP " + unit.TopUnitHealth;
            damageSelectedText.text     = "Урон " + unit.Damage;
            initiativeSelectedText.text = "Инициатива " + unit.Initiative;

            List <IDisplayableIcon> icons = new List <IDisplayableIcon>();

            icons.AddRange(unit.GetComponentsInChildren <IDisplayableIcon>());
            for (int i = 0; i < icons.Count; i++)
            {
                IDisplayableIcon icon = icons[i];
                DisplaySelectedUnitIcon(icon, i);
            }
        }
コード例 #2
0
        public void PrintActiveUnitStats(UnitStackBase unit)
        {
            ClearActiveUnitStats();

            nameActiveText.gameObject.SetActive(true);
            numberActiveText.gameObject.SetActive(true);
            HPActiveText.gameObject.SetActive(true);
            currentHPActiveText.gameObject.SetActive(true);
            damageActiveText.gameObject.SetActive(true);
            initiativeActiveText.gameObject.SetActive(true);

            nameActiveText.text       = unit.UnitName;
            numberActiveText.text     = "Количество " + unit.NumberOfUnits;
            HPActiveText.text         = "Max HP " + unit.MaxHealth;
            currentHPActiveText.text  = "Current HP " + unit.TopUnitHealth;
            damageActiveText.text     = "Урон " + unit.Damage;
            initiativeActiveText.text = "Инициатива " + unit.Initiative;

            List <IActiveAbility> abilities = new List <IActiveAbility>();

            abilities.AddRange(unit.GetComponentsInChildren <IActiveAbility>());
            foreach (IActiveAbility ability in abilities)
            {
                SetActiveUnitAbility(ability);
            }
            List <IDisplayableIcon> blackList = new List <IDisplayableIcon>();

            blackList.AddRange(abilities);

            List <IDisplayableIcon> icons = new List <IDisplayableIcon>();

            icons.AddRange(unit.GetComponentsInChildren <IDisplayableIcon>());
            foreach (IDisplayableIcon icon in icons)
            {
                if (blackList.Contains(icon))
                {
                    continue;
                }

                DisplayActiveUnitIcon(icon);
            }
        }