Beispiel #1
0
        public static void SubStats(AbstractGameObject ent, Stats stats)
        {
            ent.EntStats.SubStats(stats);
            ent.UpgradedStats.SubStats(stats);

            if (ClickManager.IsChoosed(ent.gameObject))
            {
                UnitBar_HTML.UpdateInfo(ent);
            }
        }
Beispiel #2
0
        public static void HealUnit(AbstractGameObject ent, int countHp)
        {
            var maxHp = ent.EntStats.Hp;
            var endHp = ent.UpgradedStats.Hp + countHp;

            if (endHp > maxHp)
            {
                endHp = maxHp;
            }
            ent.UpgradedStats.Hp = endHp;

            if (ClickManager.IsChoosed(ent.gameObject))
            {
                UnitBar_HTML.UpdateInfo(ent);
            }
        }
        public static WorldUI SetupUnitBar(GameEntity ent)
        {
            WorldUI unitBar;

            if (UIDict.ContainsKey(ent) && UIDict[ent].gameObject != null)
            {
                unitBar = UIDict[ent];
                SetEnable(unitBar, true);
                if (unitBar.Expires)
                {
                    unitBar.CancelExpiry();
                }
                return(unitBar);
            }

            //UI
            unitBar     = new WorldUI(BarWeight, BarHeight);
            UIDict[ent] = unitBar;

            //Return or Create
            var point = SetupPoint(ent);

            //Attach to point and setup HTML
            unitBar.ParentToOrigin(point.transform);
            unitBar.document.innerHTML = StaticUnitBarHTML.text;

            //Unit special info
            var name = LanguageTextManager.GetTextByName(ent.OriginalName);

            unitBar.document.Run("SetupUnitName", name);

            var unit = ent as AbstractGameObject;

            if (unit == null)
            {
                return(unitBar);
            }
            if (!ClickManager.IsChoosed(unit.gameObject))
            {
                unitBar.SetExpiry(5f);
            }
            UpdateInfo(unit);
            return(unitBar);
        }
 public bool isChoosed()
 {
     return(ClickManager.IsChoosed(this));
 }