Ejemplo n.º 1
0
        public Nutcracker3Scene(IEnumerable <string> args)
        {
            candyLight = new StrobeColorDimmer("Candy Light");
            testButton = new DigitalInput("Test");

            allPixels1 = new VirtualPixel1D(256);
            allPixels2 = new VirtualPixel1D(256);
            allPixels1.SetAll(Color.White, 0);
            allPixels2.SetAll(Color.White, 0);

            var lorImport = new Import.LorImport(@"C:\Users\HLindestaf\Downloads\coke_song\Coke-Cola Christmas.lms");

            var channelNames = lorImport.GetChannels.Select(x => lorImport.GetChannelName(x)).ToList();

            channelNames.ForEach(x => Console.WriteLine(x));

            int pixelPosition = 0;

            var circuits = lorImport.GetChannels.GetEnumerator();

            while (true)
            {
                //                Controller.IChannelIdentity channelR, channelG, channelB;
                Controller.IChannelIdentity channel;

                if (!circuits.MoveNext())
                {
                    break;
                }
                channel = circuits.Current;

                VirtualPixel1D pixel1d;
                int            pixelNum;
                if (pixelPosition < 256)
                {
                    pixel1d  = allPixels1;
                    pixelNum = pixelPosition;
                }
                else
                {
                    pixel1d  = allPixels2;
                    pixelNum = pixelPosition - 256;
                }

                var pixel = lorImport.MapDevice(
                    channel,
                    name => new SinglePixel(name, pixel1d, pixelNum));

                log.Debug("Mapping channel [{0}] to pixel {1} [{2}]",
                          channel,
                          pixelPosition,
                          pixel.Name);

                pixelPosition++;
            }

            lorTimeline = lorImport.CreateTimeline(1);
        }
 private void SetPixelColor()
 {
     if (manualFader.Value)
     {
         pixelsRoofEdge.SetAll(GetFaderColor(), faderBright.Value);
     }
     else
     {
         if (hoursSmall.IsOpen)
         {
             pixelsRoofEdge.SetAll(
                 HSV.ColorFromRGB(0.73333333333333328, 0, 1),
                 0.16470588235294117);
         }
         else
         {
             pixelsRoofEdge.SetAll(Color.Black, 0.0);
         }
     }
 }
Ejemplo n.º 3
0
        public Nutcracker1Scene(IEnumerable <string> args)
        {
            testButton = new DigitalInput("Test");

            allPixels = new VirtualPixel1D(60);
            allPixels.SetAll(Color.White, 0);

            var lorImport = new Import.LorImport(@"..\..\..\Test Files\HAUK~HALLOWEEN1.lms");

            int pixelPosition = 0;

            var circuits = lorImport.GetChannels.GetEnumerator();

            while (true)
            {
                Controller.IChannelIdentity channelR, channelG, channelB;

                if (!circuits.MoveNext())
                {
                    break;
                }
                channelR = circuits.Current;

                if (!circuits.MoveNext())
                {
                    break;
                }
                channelG = circuits.Current;

                if (!circuits.MoveNext())
                {
                    break;
                }
                channelB = circuits.Current;

                var pixel = lorImport.MapDevice(
                    channelR,
                    channelG,
                    channelB,
                    name => new SinglePixel(name, allPixels, pixelPosition));

                log.Debug("Mapping channel R[{0}]/G[{1}]/B[{2}] to pixel {3} [{4}]",
                          channelR,
                          channelG,
                          channelB,
                          pixelPosition,
                          pixel.Name);

                pixelPosition++;
            }

            lorTimeline = lorImport.CreateTimeline(null);
        }
Ejemplo n.º 4
0
        public LORScene(IEnumerable <string> args)
        {
            allPixels = new VirtualPixel1D(80);
            allPixels.SetAll(Color.White, 0);

            lorImport.LoadFromFile(@"..\..\..\Test Files\Cannon Rock104.lms");

            lorImport.MapDevice("Roof 1", lightRoof1);
            lorImport.MapDevice("Roof 2", lightRoof2);
            lorImport.MapDevice("Roof 3", lightRoof3);
            lorImport.MapDevice("Roof 4", lightRoof4);

            lorImport.MapDevice("Sidewalk 1", lightSidewalk1);
            lorImport.MapDevice("Sidewalk 2", lightSidewalk2);
            lorImport.MapDevice("Sidewalk 3", lightSidewalk3);
            lorImport.MapDevice("Sidewalk 4", lightSidewalk4);
            lorImport.MapDevice("Sidewalk 5", lightSidewalk1);
            lorImport.MapDevice("Sidewalk 6", lightSidewalk2);
            lorImport.MapDevice("Sidewalk 7", lightSidewalk3);
            lorImport.MapDevice("Sidewalk 8", lightSidewalk4);

            lorImport.MapDevice("Arch 1", light5_2);

            lorImport.Prepare();
            lorImport.Dump();


            waveSource = CodecFactory.Instance.GetCodec(@"C:\Projects\Other\ChristmasSounds\trk\21. Christmas Canon Rock.wav");

            soundOut.Initialize(waveSource);


            //            light5_1 = lorImport.MapDevice(1, 1, name => new StrobeColorDimmer(name));


            /*
             *          light1_1 = lorImport.MapDevice(1, 1, name => new StrobeColorDimmer(name));
             *          light1_2 = lorImport.MapDevice(1, 2, name => new StrobeColorDimmer(name));
             *          light1_3 = lorImport.MapDevice(1, 3, name => new StrobeColorDimmer(name));
             *          light1_4 = lorImport.MapDevice(1, 4, name => new StrobeColorDimmer(name));
             *          light1_5 = lorImport.MapDevice(1, 5, name => new StrobeColorDimmer(name));
             *          light1_6 = lorImport.MapDevice(1, 6, name => new StrobeColorDimmer(name));
             *          light1_7 = lorImport.MapDevice(1, 7, name => new StrobeColorDimmer(name));
             *          light1_8 = lorImport.MapDevice(1, 8, name => new StrobeColorDimmer(name));
             *          light1_9 = lorImport.MapDevice(1, 9, name => new StrobeColorDimmer(name));
             *          light1_10 = lorImport.MapDevice(1, 10, name => new StrobeColorDimmer(name));
             *          light1_11 = lorImport.MapDevice(1, 11, name => new StrobeColorDimmer(name));
             *          light1_12 = lorImport.MapDevice(1, 12, name => new StrobeColorDimmer(name));
             *          light1_13 = lorImport.MapDevice(1, 13, name => new StrobeColorDimmer(name));
             *          light1_14 = lorImport.MapDevice(1, 14, name => new StrobeColorDimmer(name));
             *          light1_15 = lorImport.MapDevice(1, 15, name => new StrobeColorDimmer(name));
             *          light1_16 = lorImport.MapDevice(1, 16, name => new StrobeColorDimmer(name));
             *
             *          light2_1 = lorImport.MapDevice(2, 1, name => new StrobeColorDimmer(name));
             *          light2_2 = lorImport.MapDevice(2, 2, name => new StrobeColorDimmer(name));
             *          light2_3 = lorImport.MapDevice(2, 3, name => new StrobeColorDimmer(name));
             *          light2_4 = lorImport.MapDevice(2, 4, name => new StrobeColorDimmer(name));
             *          light2_5 = lorImport.MapDevice(2, 5, name => new StrobeColorDimmer(name));
             *          light2_6 = lorImport.MapDevice(2, 6, name => new StrobeColorDimmer(name));
             *          light2_7 = lorImport.MapDevice(2, 7, name => new StrobeColorDimmer(name));
             *          light2_8 = lorImport.MapDevice(2, 8, name => new StrobeColorDimmer(name));
             *          light2_9 = lorImport.MapDevice(2, 9, name => new StrobeColorDimmer(name));
             *          light2_10 = lorImport.MapDevice(2, 10, name => new StrobeColorDimmer(name));
             *          light2_11 = lorImport.MapDevice(2, 11, name => new StrobeColorDimmer(name));
             *          light2_12 = lorImport.MapDevice(2, 12, name => new StrobeColorDimmer(name));
             *          light2_13 = lorImport.MapDevice(2, 13, name => new StrobeColorDimmer(name));
             *          light2_14 = lorImport.MapDevice(2, 14, name => new StrobeColorDimmer(name));
             *          light2_15 = lorImport.MapDevice(2, 15, name => new StrobeColorDimmer(name));
             *          light2_16 = lorImport.MapDevice(2, 16, name => new StrobeColorDimmer(name));
             *
             *          light3_1 = lorImport.MapDevice(3, 1, name => new StrobeColorDimmer(name));
             *          light3_2 = lorImport.MapDevice(3, 2, name => new StrobeColorDimmer(name));
             *          light3_3 = lorImport.MapDevice(3, 3, name => new StrobeColorDimmer(name));
             *          light3_4 = lorImport.MapDevice(3, 4, name => new StrobeColorDimmer(name));
             *          light3_5 = lorImport.MapDevice(3, 5, name => new StrobeColorDimmer(name));
             *          light3_6 = lorImport.MapDevice(3, 6, name => new StrobeColorDimmer(name));
             *          light3_7 = lorImport.MapDevice(3, 7, name => new StrobeColorDimmer(name));
             *          light3_8 = lorImport.MapDevice(3, 8, name => new StrobeColorDimmer(name));
             *          light3_9 = lorImport.MapDevice(3, 9, name => new StrobeColorDimmer(name));
             *          light3_10 = lorImport.MapDevice(3, 10, name => new StrobeColorDimmer(name));
             *          light3_11 = lorImport.MapDevice(3, 11, name => new StrobeColorDimmer(name));
             *          light3_12 = lorImport.MapDevice(3, 12, name => new StrobeColorDimmer(name));
             *          light3_13 = lorImport.MapDevice(3, 13, name => new StrobeColorDimmer(name));
             *          light3_14 = lorImport.MapDevice(3, 14, name => new StrobeColorDimmer(name));
             *          light3_15 = lorImport.MapDevice(3, 15, name => new StrobeColorDimmer(name));
             *          light3_16 = lorImport.MapDevice(3, 16, name => new StrobeColorDimmer(name));
             *
             *          light4_1 = lorImport.MapDevice(4, 1, name => new StrobeColorDimmer(name));
             *          light4_2 = lorImport.MapDevice(4, 2, name => new StrobeColorDimmer(name));
             *          light4_3 = lorImport.MapDevice(4, 3, name => new StrobeColorDimmer(name));
             *          light4_4 = lorImport.MapDevice(4, 4, name => new StrobeColorDimmer(name));
             *          light4_5 = lorImport.MapDevice(4, 5, name => new StrobeColorDimmer(name));
             *          light4_6 = lorImport.MapDevice(4, 6, name => new StrobeColorDimmer(name));
             *          light4_7 = lorImport.MapDevice(4, 7, name => new StrobeColorDimmer(name));
             *          light4_8 = lorImport.MapDevice(4, 8, name => new StrobeColorDimmer(name));
             *          light4_9 = lorImport.MapDevice(4, 9, name => new StrobeColorDimmer(name));
             *          light4_10 = lorImport.MapDevice(4, 10, name => new StrobeColorDimmer(name));
             *          light4_11 = lorImport.MapDevice(4, 11, name => new StrobeColorDimmer(name));
             *          light4_12 = lorImport.MapDevice(4, 12, name => new StrobeColorDimmer(name));
             *          light4_13 = lorImport.MapDevice(4, 13, name => new StrobeColorDimmer(name));
             *          light4_14 = lorImport.MapDevice(4, 14, name => new StrobeColorDimmer(name));
             *          light4_15 = lorImport.MapDevice(4, 15, name => new StrobeColorDimmer(name));
             *          light4_16 = lorImport.MapDevice(4, 16, name => new StrobeColorDimmer(name));
             *
             *          light5_1 = lorImport.MapDevice(5, 1, name => new StrobeColorDimmer(name));
             *          light5_2 = lorImport.MapDevice(5, 2, name => new StrobeColorDimmer(name));
             *          light5_3 = lorImport.MapDevice(5, 3, name => new StrobeColorDimmer(name));
             *          light5_4 = lorImport.MapDevice(5, 4, name => new StrobeColorDimmer(name));
             *          light5_5 = lorImport.MapDevice(5, 5, name => new StrobeColorDimmer(name));
             *          light5_6 = lorImport.MapDevice(5, 6, name => new StrobeColorDimmer(name));
             *          light5_7 = lorImport.MapDevice(5, 7, name => new StrobeColorDimmer(name));
             *          light5_8 = lorImport.MapDevice(5, 8, name => new StrobeColorDimmer(name));
             *          light5_9 = lorImport.MapDevice(5, 9, name => new StrobeColorDimmer(name));
             *          light5_10 = lorImport.MapDevice(5, 10, name => new StrobeColorDimmer(name));
             *          light5_11 = lorImport.MapDevice(5, 11, name => new StrobeColorDimmer(name));
             *          light5_12 = lorImport.MapDevice(5, 12, name => new StrobeColorDimmer(name));
             *          light5_13 = lorImport.MapDevice(5, 13, name => new StrobeColorDimmer(name));
             *          light5_14 = lorImport.MapDevice(5, 14, name => new StrobeColorDimmer(name));
             *          light5_15 = lorImport.MapDevice(5, 15, name => new StrobeColorDimmer(name));
             *          light5_16 = lorImport.MapDevice(5, 16, name => new StrobeColorDimmer(name));
             */

            /*TEST            light5_1 = lorImport.MapDevice(new Import.LorImport.UnitCircuit(5, 1), name => new StrobeColorDimmer(name));
             *
             *          for (int unit = 1; unit <= 5; unit++)
             *          {
             *              for (int circuit = 1; circuit <= 16; circuit++)
             *              {
             *                  int pixelPos = (unit - 1) * 16 + circuit - 1;
             *
             *                  var pixel = lorImport.MapDevice(new Import.LorImport.UnitCircuit(unit, circuit), name => new SinglePixel(name, allPixels, pixelPos));
             *
             * //FIXME                    var color = lorImport.GetChannelColor(unit, circuit);
             * //FIXME                    allPixels.SetColor(pixelPos, color, 0);
             *
             *                  log.Debug("Mapping unit {0}  circuit {1} to pixel {2} [{3}]", unit, circuit, pixelPos, pixel.Name);
             *              }
             *          }
             */
        }
Ejemplo n.º 5
0
 private void TestAllPixels(Color color, double brightness, TimeSpan delay)
 {
     allPixels.SetAll(color, brightness);
     System.Threading.Thread.Sleep(delay);
 }
        public override void Start()
        {
            hoursSmall.AddRange("5:00 pm", "9:00 pm");
            hoursFull.AddRange("5:00 pm", "9:00 pm");
            //hoursFull.SetForced(true);
            //hoursSmall.SetForced(true);
            //hoursFull.SetForced(false);
            //hoursSmall.SetForced(false);

#if !true
            hoursFull.SetForced(true);

            audioBeauty.SetSilent(true);
            audioCat.SetSilent(true);
            audioGeorge.SetSilent(true);
            audioSpider.SetSilent(true);
            georgeMotor.SetDisabled(true);
#endif
            var backgroundSeq = new Controller.Sequence("BG Sequence");
            backgroundSeq.WhenExecuted
            .SetUp(() =>
            {
                audioGeorge.PlayBackground();
                lightFloor.SetOnlyColor(Color.Orange);
                pulsatingEffect1.Start();
                flickerEffect.Start();
            })
            .Execute(instance =>
            {
                while (!instance.IsCancellationRequested)
                {
                    instance.WaitFor(S(1));
                    if (!this.lastFogRun.HasValue || (DateTime.Now - this.lastFogRun.Value).TotalMinutes > 10)
                    {
                        // Run the fog for a little while
                        switchFog.SetPower(true);
                        instance.WaitFor(S(4));
                        switchFog.SetPower(false);
                        this.lastFogRun = DateTime.Now;
                    }
                }
            })
            .TearDown(() =>
            {
                audioGeorge.PauseBackground();
                pulsatingEffect1.Stop();
                flickerEffect.Stop();
            });

            var deadendSeq = new Controller.Sequence("Deadend dr");
            deadendSeq.WhenExecuted
            .Execute(instance =>
            {
                switchDeadendDrive.SetPower(true);
                Thread.Sleep(1000);
                switchDeadendDrive.SetPower(false);
            });

            var stairSeq = new Controller.Sequence("Stair Sequence");
            stairSeq.WhenExecuted
            .SetUp(() =>
            {
            })
            .Execute(instance =>
            {
                switchFog.SetPower(true);
                this.lastFogRun = DateTime.Now;
                Executor.Current.Execute(deadendSeq);
                audioGeorge.PlayEffect("ghostly");
                instance.WaitFor(S(0.5));
                popOutEffect.Pop(1.0);

                instance.WaitFor(S(1.0));
                audioSpider.PlayNewEffect("348 Spider Hiss");
                switchSpider.SetPower(true);
                instance.WaitFor(S(0.5));
                switchSpiderEyes1.SetPower(true);
                instance.WaitFor(S(2));
                switchSpider.SetPower(false);
                switchSpiderEyes1.SetPower(false);
                instance.WaitFor(S(4));
                stateMachine.NextState();
            })
            .TearDown(() =>
            {
                switchFog.SetPower(false);
                audioGeorge.PauseFX();
            });

            var georgeReturnSeq = new Controller.Sequence("George Return Seq");
            georgeReturnSeq.WhenExecuted
            .Execute(instance =>
            {
                georgeMotor.WaitForVectorReached();
                georgeMotor.SetVector(0.9, 0, S(15));
                georgeMotor.WaitForVectorReached();
            });

            var georgeSeq = new Controller.Sequence("George Sequence");
            georgeSeq.WhenExecuted
            .Execute(instance =>
            {
                //Exec.WaitUntilFinished(georgeReturnSeq);

                audioGeorge.PlayEffect("laugh");
                georgeMotor.SetVector(1.0, 350, S(10));
                instance.WaitFor(TimeSpan.FromSeconds(0.8));
                lightGeorge.SetColor(Color.Red);
                georgeMotor.WaitForVectorReached(instance);
                instance.WaitFor(TimeSpan.FromSeconds(2));
                georgeMotor.SetVector(0.9, 0, S(15));
                lightGeorge.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                instance.WaitFor(TimeSpan.FromSeconds(1));
                lightFloor.SetOnlyColor(Color.Green);
                pulsatingEffect1.Start();
                georgeMotor.WaitForVectorReached(instance);

                instance.WaitFor(S(15));
            })
            .TearDown(() =>
            {
                Exec.Execute(georgeReturnSeq);
                pulsatingEffect1.Stop();
                lightGeorge.TurnOff();
            });

            var spiderEyes2Seq = new Controller.Sequence("Spider Eyes 2");
            spiderEyes2Seq.WhenExecuted
            .Execute(instance =>
            {
                var rnd = new Random();
                while (!instance.IsCancellationRequested)
                {
                    switchSpiderEyes2.SetPower(true);
                    instance.WaitFor(S(1.0 + rnd.Next(10)));
                    switchSpiderEyes2.SetPower(false);
                    instance.WaitFor(S(1.0 + rnd.Next(2)));
                }
            });

            var popupSeq = new Controller.Sequence("Popup Sequence");
            popupSeq.WhenExecuted
            .Execute(instance =>
            {
                audioBeauty.PlayEffect("scream", 0.0, 1.0);
                switchPopEyes.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(1.0));
                lightPopup.SetBrightness(1.0);
                switchPopUp.SetPower(true);

                instance.WaitFor(S(3));

                lightPopup.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                switchPopEyes.TurnOff();
                switchPopUp.TurnOff();
            });

            var beautySeq = new Controller.Sequence("Beauty Sequence");
            beautySeq.WhenExecuted
            .Execute(instance =>
            {
                flickerEffect2.Stop();
                lightBeauty.SetColor(Color.Purple);
                switchHand.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(1));
                audioBeauty.PlayEffect("gollum_precious1", 1.0, 0.0);
                instance.WaitFor(TimeSpan.FromSeconds(0.4));
                switchHead.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(6));
                switchHead.SetPower(false);
                switchHand.SetPower(false);

                instance.WaitFor(TimeSpan.FromSeconds(1.5));
                lightBeauty.TurnOff();
                instance.WaitFor(TimeSpan.FromSeconds(0.5));
                switchDrawer1.SetPower(true);
                switchHead.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(0.5));
                lightBeauty.SetColor(Color.Red, 1.0);
                audioBeauty.PlayEffect("my_pretty", 1.0, 0.0);
                instance.WaitFor(TimeSpan.FromSeconds(4));
                switchDrawer2.SetPower(true);
                instance.WaitFor(TimeSpan.FromSeconds(2));
                switchDrawer1.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(0.15));
                switchDrawer2.SetPower(false);
                instance.WaitFor(TimeSpan.FromSeconds(1));

                switchHead.SetPower(false);
                lightBeauty.RunEffect(new Effect2.Fader(1.0, 0.0), S(1.0));
                if (hoursSmall.IsOpen)
                {
                    flickerEffect2.Start();
                }
                instance.WaitFor(TimeSpan.FromSeconds(5));
            });


            var catSeq = new Controller.Sequence("Cat Sequence");
            catSeq.WhenExecuted
            .Execute(instance =>
            {
                var maxRuntime = System.Diagnostics.Stopwatch.StartNew();

                var random = new Random();

                catLights.SetPower(true);

                while (true)
                {
                    switch (random.Next(4))
                    {
                    case 0:
                        audioCat.PlayEffect("266 Monster Growl 7", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(2.0));
                        break;

                    case 1:
                        audioCat.PlayEffect("285 Monster Snarl 2", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(3.0));
                        break;

                    case 2:
                        audioCat.PlayEffect("286 Monster Snarl 3", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(2.5));
                        break;

                    case 3:
                        audioCat.PlayEffect("287 Monster Snarl 4", 1.0, 1.0);
                        instance.WaitFor(TimeSpan.FromSeconds(1.5));
                        break;

                    default:
                        instance.WaitFor(TimeSpan.FromSeconds(3.0));
                        break;
                    }

                    instance.CancelToken.ThrowIfCancellationRequested();

                    if (maxRuntime.Elapsed.TotalSeconds > 10)
                    {
                        break;
                    }
                }
            })
            .TearDown(() =>
            {
                catLights.TurnOff();
            });

            var candyCane = new Controller.Sequence("Candy Cane");
            candyCane
            .WhenExecuted
            .SetUp(() => allPixels.TurnOff())
            .Execute(instance =>
            {
                var cbList = new List <ColorBrightness>();
                //cbList.Add(new ColorBrightness(Color.Green, 1.00));
                //cbList.Add(new ColorBrightness(Color.Green, 0.70));
                //cbList.Add(new ColorBrightness(Color.Green, 0.40));
                //cbList.Add(new ColorBrightness(Color.White, 1.00));
                //cbList.Add(new ColorBrightness(Color.White, 0.70));
                //cbList.Add(new ColorBrightness(Color.White, 0.40));
                //cbList.Add(new ColorBrightness(Color.Red, 1.00));
                //cbList.Add(new ColorBrightness(Color.Red, 0.70));
                //cbList.Add(new ColorBrightness(Color.Red, 0.40));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));
                //cbList.Add(new ColorBrightness(Color.Black, 0.0));

                double b1 = 1.00;
                double b2 = 0.70;
                double b3 = 0.40;
                Color c1  = Color.Blue;
                Color c2  = Color.Yellow;
                Color c3  = Color.Blue;
                Color c4  = Color.Black;

                cbList.Add(new ColorBrightness(c1, b1));
                cbList.Add(new ColorBrightness(c1, b2));
                cbList.Add(new ColorBrightness(c1, b3));
                cbList.Add(new ColorBrightness(c2, b1));
                cbList.Add(new ColorBrightness(c2, b2));
                cbList.Add(new ColorBrightness(c2, b3));
                cbList.Add(new ColorBrightness(c3, b1));
                cbList.Add(new ColorBrightness(c3, b2));
                cbList.Add(new ColorBrightness(c3, b3));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));

                b1 = 1.00;
                b2 = 0.70;
                b3 = 0.40;
                c1 = Color.White;
                c2 = Color.Blue;
                c3 = Color.Red;
                c4 = Color.Black;

                cbList.Add(new ColorBrightness(c1, b1));
                cbList.Add(new ColorBrightness(c1, b2));
                cbList.Add(new ColorBrightness(c1, b3));
                cbList.Add(new ColorBrightness(c2, b1));
                cbList.Add(new ColorBrightness(c2, b2));
                cbList.Add(new ColorBrightness(c2, b3));
                cbList.Add(new ColorBrightness(c3, b1));
                cbList.Add(new ColorBrightness(c3, b2));
                cbList.Add(new ColorBrightness(c3, b3));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));

                b1 = 1.00;
                b2 = 0.70;
                b3 = 0.40;
                c1 = Color.Red;
                c2 = Color.White;
                c3 = Color.Blue;
                c4 = Color.Black;

                cbList.Add(new ColorBrightness(c1, b1));
                cbList.Add(new ColorBrightness(c1, b2));
                cbList.Add(new ColorBrightness(c1, b3));
                cbList.Add(new ColorBrightness(c2, b1));
                cbList.Add(new ColorBrightness(c2, b2));
                cbList.Add(new ColorBrightness(c2, b3));
                cbList.Add(new ColorBrightness(c3, b1));
                cbList.Add(new ColorBrightness(c3, b2));
                cbList.Add(new ColorBrightness(c3, b3));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));
                cbList.Add(new ColorBrightness(c4, 0.0));

                while (true)
                {
                    foreach (var cb in cbList)
                    {
                        allPixels.Inject(cb);
                        instance.WaitFor(S(0.350), true);
                    }
                }
            })
            .TearDown(() =>
            {
                allPixels.TurnOff();
            });


            stateMachine.ForFromSequence(States.Background, backgroundSeq);
            stateMachine.ForFromSequence(States.Stair, stairSeq);
            stateMachine.ForFromSequence(States.George, georgeSeq);
            stateMachine.ForFromSequence(States.Popup, popupSeq);

            hoursSmall.OpenHoursChanged += (sender, e) =>
            {
                if (e.IsOpenNow)
                {
                    pulsatingEffect2.Start();
                    flickerEffect.Start();
                    flickerEffect2.Start();
                    catFan.SetPower(true);
                    lightEyes.SetPower(true);
                    lightTreeGhost.SetBrightness(1.0);
                    //                        Exec.Execute(candyCane);
                    allPixels.SetAll(Color.FromArgb(255, 115, 0), 0.5);
                }
                else
                {
                    pulsatingEffect2.Stop();
                    flickerEffect.Stop();
                    flickerEffect2.Stop();
                    catFan.SetPower(false);
                    lightEyes.SetPower(false);
                    lightTreeGhost.TurnOff();
                    allPixels.TurnOff();
                }
            };

            hoursFull.OpenHoursChanged += (sender, e) =>
            {
                if (e.IsOpenNow)
                {
                    Executor.Current.Execute(spiderEyes2Seq);
                    stateMachine.SetBackgroundState(States.Background);
                    stateMachine.SetState(States.Background);
                }
                else
                {
                    Executor.Current.Cancel(spiderEyes2Seq);
                    stateMachine.Hold();
                    stateMachine.SetBackgroundState(null);
                    audioGeorge.PauseBackground();
                }
            };

            buttonMotionCat.ActiveChanged += (sender, e) =>
            {
#if CHECK_SENSOR_ALIGNMENT
                catLights.SetPower(e.NewState);
#else
                if (e.NewState && hoursSmall.IsOpen)
                {
                    Executor.Current.Execute(catSeq);
                }
#endif
            };

            buttonMotionBeauty.ActiveChanged += (sender, e) =>
            {
                if (e.NewState && hoursFull.IsOpen)
                {
                    Executor.Current.Execute(beautySeq);
                }
            };

            buttonTriggerStairs.ActiveChanged += (sender, e) =>
            {
                if (!hoursSmall.IsOpen)
                {
                    lightFloor.SetColor(Color.Purple, e.NewState ? 0.6 : 0.0);
                }
                else
                {
                    if (e.NewState && hoursFull.IsOpen)
                    {
                        if (!stateMachine.CurrentState.HasValue || stateMachine.CurrentState == States.Background)
                        {
                            stateMachine.SetState(States.Stair);
                        }
                    }
                }
            };

            buttonTriggerPopup.ActiveChanged += (sender, e) =>
            {
                if (!hoursSmall.IsOpen)
                {
                    lightPopup.SetBrightness(e.NewState ? 0.5 : 0.0);
                }
                else
                {
                    if (e.NewState)
                    {
                        if (stateMachine.CurrentState == States.George)
                        {
                            stateMachine.SetState(States.Popup);
                        }
                    }
                }
            };

            flickerEffect.AddDevice(skullsLight);
            flickerEffect2.AddDevice(skullsLight2);
            lightFloor.SetColor(Color.Orange, 0);
            lightSign.SetColor(Color.Pink, 0);
            pulsatingEffect1.AddDevice(lightFloor);
            pulsatingEffect1.AddDevice(lightSpiderWeb);
            pulsatingEffect2.AddDevice(lightSign);

            popOutEffect.AddDevice(skullsLight);

            ForTest();
        }