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

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

            sbatch.DrawScaled(
                Textures.CannonCog,
                Position,
                Scale,
                FlatColors.Clouds,
                cannonCogRotation + FloatMath.RAD_POS_270);

            int aidx = (int)(health * (Textures.ANIMATION_CANNONCOG_SIZE - 1));

            if (aidx == Textures.ANIMATION_CANNONCOG_SIZE - 1)
            {
                sbatch.DrawScaled(
                    Textures.CannonCog,
                    Position,
                    Scale,
                    Fraction.Color,
                    cannonCogRotation + FloatMath.RAD_POS_270);
            }
            else
            {
                int   aniperseg  = Textures.ANIMATION_CANNONCOG_SIZE / Textures.ANIMATION_CANNONCOG_SEGMENTS;
                float radpersegm = (FloatMath.RAD_POS_360 * 1f / Textures.ANIMATION_CANNONCOG_SEGMENTS);
                for (int i = 0; i < Textures.ANIMATION_CANNONCOG_SEGMENTS; i++)
                {
                    if (aidx >= aniperseg * i)
                    {
                        var iidx = aidx - aniperseg * i;
                        if (iidx > aniperseg + Textures.ANIMATION_CANNONCOG_OVERLAP)
                        {
                            iidx = aniperseg + Textures.ANIMATION_CANNONCOG_OVERLAP;
                        }

                        sbatch.DrawScaled(
                            Textures.AnimCannonCog[iidx],
                            Position,
                            Scale,
                            Fraction.Color,
                            cannonCogRotation + FloatMath.RAD_POS_270 + i * radpersegm);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void DrawBodyAndBarrel_FG(IBatchRenderer sbatch)
        {
            var barrelCenter = Position + new Vector2(Scale * (CANNON_DIAMETER / 2f), 0).Rotate(Rotation.ActualValue);

            sbatch.DrawScaled(
                Textures.TexLaserBarrel,
                barrelCenter,
                Scale,
                Color.White,
                Rotation.ActualValue);

            sbatch.DrawScaled(
                Textures.TexCannonBody,
                Position,
                Scale,
                Color.White,
                Rotation.ActualValue);
        }
Exemplo n.º 3
0
        private static void DrawLaserBodyAndBarrel_FG(IBatchRenderer sbatch, FPoint position, float scale, float rotation, bool isshield)
        {
            var barrelCenter = position + new Vector2(scale * (Cannon.CANNON_DIAMETER / 2f), 0).Rotate(rotation);

            sbatch.DrawScaled(
                isshield ? Textures.TexShieldBarrel : Textures.TexLaserBarrel,
                barrelCenter,
                scale,
                Color.White,
                rotation);

            sbatch.DrawScaled(
                Textures.TexCannonBody,
                position,
                scale,
                Color.White,
                rotation);
        }
Exemplo n.º 4
0
        private static void DrawLaserCore(IBatchRenderer sbatch, FPoint position, float scale, bool neutral, float health, float coreRotation, float corePulse, int coreImage, Color fracColor)
        {
            sbatch.DrawScaled(
                Textures.TexCannonCoreShadow[coreImage],
                position,
                scale * corePulse,
                Color.White,
                coreRotation);

            if (!neutral && health > 0)
            {
                sbatch.DrawScaled(
                    Textures.TexCannonCore[coreImage],
                    position,
                    scale * corePulse * FloatMath.Sqrt(health),
                    fracColor,
                    coreRotation);
            }
        }
Exemplo n.º 5
0
        private void DrawCore(IBatchRenderer sbatch)
        {
            sbatch.DrawScaled(
                Textures.TexCannonCoreShadow[coreImage],
                Position,
                Scale * CorePulse.ActualValue,
                Color.White,
                coreRotation);

            if (!Fraction.IsNeutral && CannonHealth.ActualValue > 0)
            {
                sbatch.DrawScaled(
                    Textures.TexCannonCore[coreImage],
                    Position,
                    Scale * CorePulse.ActualValue * FloatMath.Sqrt(CannonHealth.ActualValue),
                    Fraction.Color,
                    coreRotation);
            }
        }
Exemplo n.º 6
0
        private void DrawBodyAndBarrel_FG(IBatchRenderer sbatch)
        {
            var recoil = (1 - barrelRecoil) * BARREL_RECOIL_LENGTH;

            var barrelCenter = Position + new Vector2(Scale * (CANNON_DIAMETER / 2f - recoil), 0).Rotate(Rotation.ActualValue);

            sbatch.DrawScaled(
                Textures.TexCannonBarrel,
                barrelCenter,
                Scale,
                Color.White,
                Rotation.ActualValue);

            sbatch.DrawScaled(
                Textures.TexCannonBody,
                Position,
                Scale,
                Color.White,
                Rotation.ActualValue);
        }
Exemplo n.º 7
0
        private static void DrawBulletBodyAndBarrel_FG(IBatchRenderer sbatch, FPoint position, float scale, float rotation, float barrelRecoil)
        {
            var recoil = (1 - barrelRecoil) * Cannon.BARREL_RECOIL_LENGTH;

            var barrelCenter = position + new Vector2(scale * (Cannon.CANNON_DIAMETER / 2f - recoil), 0).Rotate(rotation);

            sbatch.DrawScaled(
                Textures.TexCannonBarrel,
                barrelCenter,
                scale,
                Color.White,
                rotation);

            sbatch.DrawScaled(
                Textures.TexCannonBody,
                position,
                scale,
                Color.White,
                rotation);
        }
Exemplo n.º 8
0
        protected void DrawShield(IBatchRenderer sbatch)
        {
            if (ShieldTime <= 0)
            {
                return;
            }

            sbatch.DrawScaled(
                Textures.TexCannonShieldInner,
                Position,
                Scale,
                Color.White * (ShieldTime / MAX_SHIELD_TIME),
                Rotation.ActualValue);

            sbatch.DrawScaled(
                Textures.TexCannonShieldOuter,
                Position,
                Scale,
                Color.White * (ShieldTime / MAX_SHIELD_TIME) * (FloatMath.PercSin(_shieldGlowProcess) * 0.4f + 0.6f),
                Rotation.ActualValue + _shieldRotation);
        }
Exemplo n.º 9
0
 private void DrawCrosshair(IBatchRenderer sbatch)
 {
     if (FloatMath.IsNotZero(CrosshairSize.ActualValue))
     {
         sbatch.DrawScaled(
             Textures.TexCannonCrosshair,
             Position,
             Scale * CrosshairSize.ActualValue,
             Color.White * (CROSSHAIR_TRANSPARENCY * CrosshairSize.ActualValue),
             Rotation.TargetValue);
     }
 }
Exemplo n.º 10
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var texScale = bounds.Width / (Textures.TexHUDButtonBase.Width * Textures.DEFAULT_TEXTURE_SCALE.X);

            TextureRegion2D texIcon;

            if (FloatMath.IsZero(animationProgress))
            {
                texIcon = Textures.TexHUDButtonPause[0];
            }
            else if (FloatMath.IsOne(animationProgress))
            {
                texIcon = Textures.TexHUDButtonPause[Textures.ANIMATION_HUDBUTTONPAUSE_SIZE - 1];
            }
            else
            {
                texIcon = Textures.TexHUDButtonPause[(int)(Textures.ANIMATION_HUDBUTTONPAUSE_SIZE * animationProgress)];
            }

            sbatch.DrawScaled(Textures.TexHUDButtonBase, Center, texScale, FlatColors.Asbestos, 0f);
            sbatch.DrawScaled(texIcon, Center, texScale, IsPressed ? FlatColors.WetAsphalt : FlatColors.Clouds, 0f);
        }
Exemplo n.º 11
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var scale = Size.Width * 1f / width;

            FlatRenderHelper.DrawRoundedBlurPanelBackgroundPart(sbatch, bounds, ROUNDNESS);

            if (btnIndex == 0)
            {
                sbatch.DrawScaled(
                    Textures.TexHUDButtonPauseMenuMarkerBackground,
                    Center + new Vector2(width / 2f - HUDPauseButton.DIAMETER / 2f, -(HEIGHT / 2f + MARKER_HEIGHT / 2f)) * scale,
                    scale,
                    Color.White,
                    0f);

                sbatch.DrawScaled(
                    Textures.TexHUDButtonPauseMenuMarker,
                    Center + new Vector2(width / 2f - HUDPauseButton.DIAMETER / 2f, -(HEIGHT / 2f + MARKER_HEIGHT / 2f)) * scale,
                    scale,
                    IsPressed ? FlatColors.Concrete : FlatColors.Silver,
                    0f);
            }

            SimpleRenderHelper.DrawRoundedRect(sbatch, bounds, IsPressed ? FlatColors.Concrete : FlatColors.Silver, ROUNDNESS);

            var fontBounds = Textures.HUDFontBold.MeasureString(btnText).ToFSize();

            sbatch.DrawString(
                Textures.HUDFontBold,
                btnText,
                Center + new Vector2(-width / 2f + 12 + fontScaleFactor * fontBounds.Width / 2f, 0f) * scale,
                FlatColors.Foreground,
                0f,
                fontBounds.Center,
                scale * fontScaleFactor,
                SpriteEffects.None, 0f);
        }
Exemplo n.º 12
0
        private static void DrawTrishotBodyAndBarrel_BG(IBatchRenderer sbatch, FPoint position, float scale, float rotation, float barrelRecoil)
        {
            var recoil = (1 - barrelRecoil) * Cannon.BARREL_RECOIL_LENGTH;

            var barrelCenter1 = position + new Vector2(scale * (Cannon.CANNON_DIAMETER / 2f - recoil), 0).Rotate(rotation - Cannon.TRISHOT_BARREL_ANGLE);
            var barrelCenter2 = position + new Vector2(scale * (Cannon.CANNON_DIAMETER / 2f - recoil), 0).Rotate(rotation);
            var barrelCenter3 = position + new Vector2(scale * (Cannon.CANNON_DIAMETER / 2f - recoil), 0).Rotate(rotation + Cannon.TRISHOT_BARREL_ANGLE);

            sbatch.DrawScaled(
                Textures.TexCannonBarrelShadow,
                barrelCenter1,
                scale,
                Color.White,
                rotation - Cannon.TRISHOT_BARREL_ANGLE);

            sbatch.DrawScaled(
                Textures.TexCannonBarrelShadow,
                barrelCenter2,
                scale,
                Color.White,
                rotation);

            sbatch.DrawScaled(
                Textures.TexCannonBarrelShadow,
                barrelCenter3,
                scale,
                Color.White,
                rotation + Cannon.TRISHOT_BARREL_ANGLE);

            sbatch.DrawScaled(
                Textures.TexCannonBodyShadow,
                position,
                scale,
                Color.White,
                rotation);
        }
Exemplo n.º 13
0
        private void DrawBodyAndBarrel_BG(IBatchRenderer sbatch)
        {
            var recoil = (1 - barrelRecoil) * BARREL_RECOIL_LENGTH;

            var barrelCenter1 = Position + new Vector2(Scale * (CANNON_DIAMETER / 2f - recoil), 0).Rotate(Rotation.ActualValue - TRISHOT_BARREL_ANGLE);
            var barrelCenter2 = Position + new Vector2(Scale * (CANNON_DIAMETER / 2f - recoil), 0).Rotate(Rotation.ActualValue);
            var barrelCenter3 = Position + new Vector2(Scale * (CANNON_DIAMETER / 2f - recoil), 0).Rotate(Rotation.ActualValue + TRISHOT_BARREL_ANGLE);

            sbatch.DrawScaled(
                Textures.TexCannonBarrelShadow,
                barrelCenter1,
                Scale,
                Color.White,
                Rotation.ActualValue - TRISHOT_BARREL_ANGLE);

            sbatch.DrawScaled(
                Textures.TexCannonBarrelShadow,
                barrelCenter2,
                Scale,
                Color.White,
                Rotation.ActualValue);

            sbatch.DrawScaled(
                Textures.TexCannonBarrelShadow,
                barrelCenter3,
                Scale,
                Color.White,
                Rotation.ActualValue + TRISHOT_BARREL_ANGLE);

            sbatch.DrawScaled(
                Textures.TexCannonBodyShadow,
                Position,
                Scale,
                Color.White,
                Rotation.ActualValue);
        }
Exemplo n.º 14
0
        protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
        {
            var c = FlatColors.Clouds;

            if (this.GDHUD().GDOwner.GameSpeedMode == speed)
            {
                c = FlatColors.MidnightBlue;
            }
            else if (IsPressed)
            {
                c = FlatColors.WetAsphalt;
            }

            sbatch.DrawScaled(GetTexture(), Center, 1f, c, 0f);
        }
Exemplo n.º 15
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     sbatch.DrawScaled(GetTexture(), Center, 1f, FlatColors.Clouds, 0f);
 }
Exemplo n.º 16
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     sbatch.DrawScaled(Textures.TexHUDButtonIconMusicOn, Center, 1f, FlatColors.Clouds, 0f);
 }
Exemplo n.º 17
0
 protected override void DoDraw(IBatchRenderer sbatch, FRectangle bounds)
 {
     sbatch.DrawScaled(Textures.TexHUDButtonBase, Center, 1f, ColorMath.Blend(FlatColors.Flamingo, FlatColors.Asbestos, openingProgress), 0f);
     sbatch.DrawScaled(Textures.TexHUDButtonSpeedClock, Center, 1f, FlatColors.Clouds, 0f);
     sbatch.DrawScaled(Textures.TexHUDButtonSpeedHand, Center, 1f, FlatColors.Clouds, rotation);
 }
Exemplo n.º 18
0
 protected override void DoDrawBackground(IBatchRenderer sbatch, FRectangle bounds)
 {
     sbatch.DrawScaled(Textures.TexHUDButtonBase, Center, 1f, Highlighted ? FlatColors.Emerald : FlatColors.Flamingo, 0f);
 }