IEnumerable <Color> MethodMultiply(IFxContext ctx) { foreach (ColorReal pix in mSrc.Execute(ctx)) { pix.Luminance *= Luminance; pix.Saturation *= Saturation; yield return(pix); } }
public override void FrameExecute() { var ctx = MakeCurrentContext(); mFxPerimeterRainbow.Luminance = PerimeterLuminanceMultiplier; mFxPerimeterRainbow.Saturation = Saturation.Value; mPixelMapPerimeter.Write(mFxPerimeterRainbow.Execute(ctx)); mFxStarlight.Luminance = LuminanceStarlightMultiplier; mPixelMapStars.Write(mFxStarlight.Execute(ctx)); mGlimRedGun.WriteExecute(ctx); mGlimBlueGun.WriteExecute(ctx); if (null != mFxBarrel && mFxBarrel.IsRunning) { mPixelMapBarrel.Write(mFxBarrel.Execute(ctx)); } switch (mGameState) { case GameState.Null: case GameState.SynchronizedShotsFired: return; } double lumscale = 0.0; if (GameState.CoolDown == mGameState) { mPixelMapBarrel.Write(BarrelColour()); mPixelMapStars.Write(mFxCannonTwinkle.Execute(ctx)); // take 2 seconds to return to full glow lumscale = ((CurrentTime - mGameCoolDownStart).TotalSeconds - 1) / 2; } if (lumscale < 1) { // barrel shot or cooling down } else { mGameState = GameState.Null; RecalculateButtonGlimmer(mGlimBlueGun); RecalculateButtonGlimmer(mGlimRedGun); } switch (mGameState) { case GameState.BarrelShotFired: if (!mFxBarrel.IsRunning) { mGameState = GameState.CoolDown; mGameCoolDownStart = CurrentTime; mFxBarrel = null; } break; case GameState.SynchronizedShotsFired: if (!mGlimBlueGun.CometIsRunning || !mGlimRedGun.CometIsRunning) { mGameState = GameState.BarrelShotFired; mFxBarrel = new FxComet { BaseColor = Color.FromArgb(0xff, 0, 0xff), PixelCount = 50 }; } break; } }