Exemplo n.º 1
0
        public void SetFill(StatBarType statType, float amount)
        {
            BarElement element = null;

            switch (statType)
            {
            case StatBarType.Shield:
                element = _shield;
                break;

            case StatBarType.Health:
                element = _health;
                break;

            case StatBarType.Energy:
                element = _energy;
                break;
            }
            if (TrackedAgent.IsVisible == false || (amount >= 1f && !GUIManager.ShowHealthWhenFull))
            {
                element.gameObject.SetActive(false);
                return;
            }
            {
                element.SetFill(amount);
                element.gameObject.SetActive(true);
            }
        }
Exemplo n.º 2
0
        public StatBar(Player player, StatBarType type, float height)
            : base(new Vector2(16.0f, height))
        {
            myPlayer    = player;
            StatBarType = type;

            Texture tex = Res.Get <Texture>("images_gui_stattubes");

            float left = (type == Lewt.StatBarType.HitPoints) ? 0.0f : 16.0f;

            myTopSprite = new Sprite(tex)
            {
                SubrectLeft   = left,
                SubrectWidth  = 16.0f,
                SubrectHeight = 8.0f
            };

            myEmptySprite = new Sprite(tex)
            {
                SubrectLeft   = left,
                SubrectTop    = 8.0f,
                SubrectWidth  = 16.0f,
                SubrectHeight = 4.0f
            };

            myMidSprite = new Sprite(tex)
            {
                SubrectLeft   = left,
                SubrectTop    = 12.0f,
                SubrectWidth  = 16.0f,
                SubrectHeight = 4.0f
            };

            myFilledSprite = new Sprite(tex)
            {
                SubrectLeft   = left,
                SubrectTop    = 16.0f,
                SubrectWidth  = 16.0f,
                SubrectHeight = 8.0f
            };

            myBottomSprite = new Sprite(tex)
            {
                SubrectLeft   = left,
                SubrectTop    = 24.0f,
                SubrectWidth  = 16.0f,
                SubrectHeight = 8.0f
            };

            tex = Res.Get <Texture>("images_gui_statmarkerring");

            myBackMarkerRingSprite = new Sprite(tex)
            {
                SubrectHeight = 8.0f
            };

            myFrontMarkerRingSprite = new Sprite(tex)
            {
                SubrectTop    = 8.0f,
                SubrectHeight = 8.0f
            };

            UpdateSprites();

            MarkerRatio = -1.0;
        }