Exemplo n.º 1
0
        private void DrawCog(IBatchRenderer sbatch)
        {
            var health = CannonHealth.ActualValue;

            if (health > 0.99)
            {
                health = 1f;
            }

            sbatch.DrawCentered(
                Textures.TexPixel,
                Position,
                Scale * MINIGUNSTRUCT_DIAMETER,
                Scale * MINIGUNSTRUCT_DIAMETER,
                FlatColors.Clouds,
                FloatMath.RAD_POS_000 - cannonCogRotation);

            sbatch.DrawCentered(
                Textures.TexPixel,
                Position,
                Scale * MINIGUNSTRUCT_DIAMETER,
                Scale * MINIGUNSTRUCT_DIAMETER,
                FlatColors.Clouds,
                FloatMath.RAD_POS_000 + cannonCogRotation);

            if (health < 0.01)
            {
                // nothing
            }
            else if (health < 1)
            {
                var r = FRectangle.CreateByCenter(Position, health * Scale * MINIGUNSTRUCT_DIAMETER, health * Scale * MINIGUNSTRUCT_DIAMETER);

                sbatch.FillRectangleRot(r, Fraction.Color * (1 - health), FloatMath.RAD_POS_000 + cannonCogRotation);
                sbatch.FillRectangleRot(r, Fraction.Color * (1 - health), FloatMath.RAD_POS_000 - cannonCogRotation);

                sbatch.DrawRectangleRot(r, Fraction.Color, FloatMath.RAD_POS_000 + cannonCogRotation, 2f);
                sbatch.DrawRectangleRot(r, Fraction.Color, FloatMath.RAD_POS_000 - cannonCogRotation, 2f);
            }
            else
            {
                var r = FRectangle.CreateByCenter(Position, Scale * MINIGUNSTRUCT_DIAMETER, Scale * MINIGUNSTRUCT_DIAMETER);

                sbatch.DrawRectangleRot(r, Fraction.Color, FloatMath.RAD_POS_000 + cannonCogRotation, 2f);
                sbatch.DrawRectangleRot(r, Fraction.Color, FloatMath.RAD_POS_000 - cannonCogRotation, 2f);
            }
        }
Exemplo n.º 2
0
        private static void DrawDoubleRect(IBatchRenderer sbatch, FPoint position, float scale, float health, float cogRotation, Color fracColor)
        {
            if (health > 0.99)
            {
                health = 1f;
            }

            sbatch.DrawCentered(
                Textures.TexPixel,
                position,
                scale * Cannon.MINIGUNSTRUCT_DIAMETER,
                scale * Cannon.MINIGUNSTRUCT_DIAMETER,
                FlatColors.Clouds,
                FloatMath.RAD_POS_000 - cogRotation);

            sbatch.DrawCentered(
                Textures.TexPixel,
                position,
                scale * Cannon.MINIGUNSTRUCT_DIAMETER,
                scale * Cannon.MINIGUNSTRUCT_DIAMETER,
                FlatColors.Clouds,
                FloatMath.RAD_POS_000 + cogRotation);

            if (health < 0.01)
            {
                // nothing
            }
            else if (health < 1)
            {
                var r = FRectangle.CreateByCenter(position, health * scale * Cannon.MINIGUNSTRUCT_DIAMETER, health * scale * Cannon.MINIGUNSTRUCT_DIAMETER);

                sbatch.FillRectangleRot(r, fracColor * (1 - health), FloatMath.RAD_POS_000 + cogRotation);
                sbatch.FillRectangleRot(r, fracColor * (1 - health), FloatMath.RAD_POS_000 - cogRotation);

                sbatch.DrawRectangleRot(r, fracColor, FloatMath.RAD_POS_000 + cogRotation, 2f);
                sbatch.DrawRectangleRot(r, fracColor, FloatMath.RAD_POS_000 - cogRotation, 2f);
            }
            else
            {
                var r = FRectangle.CreateByCenter(position, scale * Cannon.MINIGUNSTRUCT_DIAMETER, scale * Cannon.MINIGUNSTRUCT_DIAMETER);

                sbatch.DrawRectangleRot(r, fracColor, FloatMath.RAD_POS_000 + cogRotation, 2f);
                sbatch.DrawRectangleRot(r, fracColor, FloatMath.RAD_POS_000 - cogRotation, 2f);
            }
        }