protected override void OnProgress(HUDTextBox owner, float progress, SAMTime gameTime, InputState istate)
        {
            var p = FloatMath.AbsSin(progress * (BLINK_COUNT / 2f) * FloatMath.TAU);

            owner.ColorBackground = ColorMath.Blend(baseColor1, highlightColor, p);
            owner.ColorFocused    = ColorMath.Blend(baseColor2, highlightColor, p);
        }
示例#2
0
        private void DrawNetwork(IBatchRenderer sbatch)
        {
            foreach (var src in _network.Sources)
            {
                foreach (var ray in src.Lasers)
                {
                    if (src.LaserPowered)
                    {
                        sbatch.DrawCentered(
                            (src.Type == RayType.Laser) ? Textures.TexLaserBase : Textures.TexShieldLaserBase,
                            FPoint.MiddlePoint(ray.Start, ray.End),
                            ray.Length + RAY_WIDTH / 4f,
                            RAY_WIDTH,
                            Color.White,
                            ray.Angle);
                    }
                    else
                    {
                        sbatch.DrawCentered(
                            (src.Type == RayType.Laser) ? Textures.TexLaserPointer : Textures.TexShieldLaserPointer,
                            FPoint.MiddlePoint(ray.Start, ray.End),
                            ray.Length, RAY_WIDTH,
                            Color.White,
                            ray.Angle);
                    }
                }
            }

            foreach (var src in _network.Sources)
            {
                if (src.LaserPowered)
                {
                    var pwr = FloatMath.AbsSin(src.UserData.LaserPulseTime * FloatMath.TAU * Cannon.LASER_GLOW_FREQ);

                    foreach (var ray in src.Lasers)
                    {
                        sbatch.DrawCentered(
                            (src.Type == RayType.Laser) ? Textures.TexLaserGlow : Textures.TexShieldLaserGlow,
                            FPoint.MiddlePoint(ray.Start, ray.End),
                            ray.Length + RAY_WIDTH / 4f,
                            2 * RAY_WIDTH,
                            src.LaserFraction.Color * pwr,
                            ray.Angle);
                    }
                }
            }

            foreach (var src in _network.Sources)
            {
                foreach (var ray in src.Lasers)
                {
                    var size = FLARE_SIZE_SMALL;
                    if (src.LaserPowered)
                    {
                        size = FLARE_SIZE_BIG;
                    }

                    size += FloatMath.Sin(_flareScale) * FLARE_PULSE_SCALE;

                    switch (ray.Terminator)
                    {
                    case LaserRayTerminator.VoidObject:
                        sbatch.DrawCentered(ray.RayType == RayType.Laser ? Textures.TexLaserFlare : Textures.TexShieldLaserFlare, ray.End, size, size, Color.White, _flareRotation);
                        break;

                    case LaserRayTerminator.Target:
                        if (ray.RayType == RayType.Laser)
                        {
                            sbatch.DrawCentered(Textures.TexLaserFlare, ray.End, size, size, Color.White, _flareRotation);
                        }
                        break;

                    case LaserRayTerminator.LaserMultiTerm:

                        var lsr = ray.RayType == RayType.Laser || ray.TerminatorRays.Any(r => r.Item1.RayType == RayType.Laser);

                        sbatch.DrawCentered(lsr ? Textures.TexLaserFlareHalf : Textures.TexShieldLaserFlareHalf, ray.End, size, size, Color.White, _flareRotation);
                        break;

                    case LaserRayTerminator.LaserSelfTerm:
                    case LaserRayTerminator.LaserFaultTerm:
                        sbatch.DrawCentered(ray.RayType == RayType.Laser ? Textures.TexLaserFlare : Textures.TexShieldLaserFlare, ray.End, size, size, Color.White, _flareRotation);
                        break;

                    case LaserRayTerminator.BulletTerm:
                        sbatch.DrawCentered(ray.RayType == RayType.Laser ? Textures.TexLaserFlare : Textures.TexShieldLaserFlare, ray.End, size, size, Color.White, _flareRotation);
                        break;

                    case LaserRayTerminator.OOB:
                    case LaserRayTerminator.Portal:
                    case LaserRayTerminator.Glass:
                    case LaserRayTerminator.Mirror:
                        //no draw
                        break;

                    default:
                        SAMLog.Error("LASER::EnumSwitch_DN", "value: " + ray.Terminator);
                        break;
                    }
                }
            }
        }