Draw() public method

public Draw ( GraphicsDevice g, List insts ) : void
g GraphicsDevice
insts List
return void
Example #1
0
        public void DrawHealth()
        {
            if (teamInput.selected.Count < 1)
            {
                return;
            }

            var lhv = new List <VertexHealthInstance>(teamInput.selected.Count);

            for (int c = teamInput.selected.Count - 1; c >= 0; c--)
            {
                IEntity e = teamInput.selected[c];
                VertexHealthInstance vert = new VertexHealthInstance();
                vert.Position   = e.WorldPosition;
                vert.Position.Y = e.BBox.Max.Y;

                float mh = 1f;
                if (e as RTSBuilding != null)
                {
                    mh = (e as RTSBuilding).Data.Health;
                }
                else
                {
                    mh = (e as RTSUnit).Data.Health;
                }

                vert.DirRadiusHealth = new Vector4(
                    e.ViewDirection,
                    e.CollisionGeometry.BoundingRadius * args.FXHealthRadiusModifier,
                    e.Health / mh
                    );
                vert.Tint = args.FXHealthTint;

                lhv.Add(vert);
            }

            healthView.Draw(G, lhv);
        }