Example #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);
            }
        }
        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);
            }
        }
Example #3
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            CommonWallRenderer.DrawVoidWall_BG(sbatch, _length, _rotation, _rectsUnrotated);

#if DEBUG
            if (DebugSettings.Get("DebugEntityBoundaries"))
            {
                foreach (var r in _rectsUnrotated)
                {
                    sbatch.DrawRectangleRot(r, Color.Cyan, _rotation);
                }
            }
#endif
        }
Example #4
0
        protected override void OnDraw(IBatchRenderer sbatch)
        {
            if (_renderPartCount <= 1)
            {
                sbatch.DrawStretched(Textures.TexVoidWall_BG_L1, _rectsUnrotated[0], Color.White, _rotation);
            }
            else if (_renderPartCount == 2)
            {
                sbatch.DrawStretched(Textures.TexVoidWall_BG_L2, _rectsUnrotated[0], Color.White, _rotation);
            }
            else
            {
                for (int i = 0; i < _renderPartCount; i++)
                {
                    if (i == 0)
                    {
                        sbatch.DrawStretched(Textures.TexVoidWall_BG_End, _rectsUnrotated[i], Color.White, _rotation + FloatMath.RAD_POS_180);
                    }
                    else if (i + 1 < _renderPartCount)
                    {
                        sbatch.DrawStretched(Textures.TexVoidWall_BG_Middle, _rectsUnrotated[i], Color.White, _rotation);
                    }
                    else
                    {
                        sbatch.DrawStretched(Textures.TexVoidWall_BG_End, _rectsUnrotated[i], Color.White, _rotation);
                    }
                }
            }

#if DEBUG
            if (DebugSettings.Get("DebugEntityBoundaries"))
            {
                foreach (var r in _rectsUnrotated)
                {
                    sbatch.DrawRectangleRot(r, Color.Cyan, _rotation);
                }
            }
#endif
        }