예제 #1
0
        public void Start()
        {
            // Set color
            candyLight.SetColor(Color.Violet, 0);
            candyLight2.SetColor(Color.Green, 0);

            var testSequence = new Sequence("Test Sequence");
            testSequence
                .WhenExecuted
                .Execute(instance =>
                {
                    pulsatingEffect.Start();

                    instance.WaitFor(TimeSpan.FromSeconds(3));

                    pulsatingEffect.Stop();

                    candyLight.SetStrobe(1.0, Color.Yellow);

                    instance.WaitFor(TimeSpan.FromSeconds(2));
                    candyLight.TurnOff();
                    candyLight.SetColor(Color.Violet, 0);
                });

            pressureMat.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Console.WriteLine("Button press!");

                    Executor.Current.Execute(testSequence);
                }
            };

            pulsatingEffect.AddDevice(candyLight)
                .AddDevice(candyLight2);
        }
예제 #2
0
        public void Start()
        {
            var explosion = new Sequence("Explosion");
            explosion.WhenExecuted
            .Execute(instance =>
            {
                audioPlayer.PlayEffect("18384__inferno__largex");
                instance.WaitFor(TimeSpan.FromMilliseconds(300));
                int d = 100;
                explosion1.SetBrightness(1);
                instance.WaitFor(TimeSpan.FromMilliseconds(d));
                explosion1.SetBrightness(0.5);
                explosion2.SetBrightness(1);
                instance.WaitFor(TimeSpan.FromMilliseconds(d));
                explosion1.TurnOff();
                explosion2.SetBrightness(0.5);
                explosion3.SetBrightness(1);
                instance.WaitFor(TimeSpan.FromMilliseconds(d));
                explosion2.TurnOff();
                explosion3.SetBrightness(0.5);
                explosion4.SetBrightness(1);
                instance.WaitFor(TimeSpan.FromMilliseconds(d));
                explosion3.TurnOff();
                explosion4.SetBrightness(0.5);
                instance.WaitFor(TimeSpan.FromMilliseconds(d));
                explosion4.TurnOff();
            });

            var seq = new Sequence("Seq");
            seq.WhenExecuted
            .Execute(instance =>
                {
            //                    audioPlayer.PlayEffect("tie_fighter");
            //                    x.WaitFor(TimeSpan.FromSeconds(2));

                    audioPlayer.PlayEffect("Lazer");
                    instance.WaitFor(TimeSpan.FromMilliseconds(300));
                    audioPlayer.PlayEffect("Lazer");

                    var cb = new ColorBrightness[6];
                    cb[0] = new ColorBrightness(Color.Black, 1.0);
                    cb[1] = new ColorBrightness(Color.Red, 1.0);
                    cb[2] = new ColorBrightness(Color.Orange, 1.0);
                    cb[3] = new ColorBrightness(Color.Yellow, 1.0);
                    cb[4] = new ColorBrightness(Color.Blue, 1.0);
                    cb[5] = new ColorBrightness(Color.White, 1.0);

                    for (int i = -6; i < 50; i++)
                    {
                        testPixels.SetColors(i, cb);
                        instance.WaitFor(TimeSpan.FromMilliseconds(10));
                    }

                    if (random.Next(10) > 5)
                        Executor.Current.Execute(explosion);
                });

            //            flickerEffect.AddDevice(candyLight);
            testButton.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    Console.WriteLine("Button press!");
                    Executor.Current.Execute(seq);
                    //                    audioPlayer.PlayEffect("Lazer");

                }
                else
                {
                    Console.WriteLine("Button depress!");

            //                    testPixels.SetColor(0, Color.Blue);
                }
            };
        }
예제 #3
0
        public void Start()
        {
            var testSequence = new Sequence("Test Sequence");
            testSequence
                .WhenExecuted
                .Execute(instance =>
                {
                    candyPulse.Start();
                    audioPlayer.PlayEffect("Laugh");
                    georgeMotor.SetVector(1.0, 160, TimeSpan.FromSeconds(5));
                    georgeStrobeLight.SetStrobe(0.55, 1.0);
                    georgeLight.SetStrobe(0.78, Color.Brown);

                    georgeMotor.WaitForVectorReached();
                    instance.WaitFor(TimeSpan.FromSeconds(2));
                    georgeStrobeLight.TurnOff();
                    georgeLight.TurnOff();

                    georgeMotor.SetVector(0.9, 0, TimeSpan.FromSeconds(6));
                    georgeMotor.WaitForVectorReached();
                    candyPulse.Stop();
                });

            var testSequence2 = new Sequence("Test Sequence 2");
                testSequence2.WhenExecuted
                .Execute(instance =>
                {
                    audioPlayer.PlayEffect("348 Spider Hiss");
                    spiderLight.SetStrobe(0.78, Color.Red);

                    spiderLift.SetPower(true);

                    instance.WaitFor(TimeSpan.FromSeconds(3));

                    // Spider up
                    audioPlayer.PlayEffect("Scream");
                    spiderLift.SetPower(false);

                    instance.WaitFor(TimeSpan.FromSeconds(2));
                    spiderLight.TurnOff();
                });

            var testSequence3 = new Sequence("Test Sequence 3");
            testSequence3.WhenExecuted
                .Execute(instance =>
                {
                    spiderEyes.SetPower(true);
                    instance.WaitFor(TimeSpan.FromSeconds(10));
                    spiderEyes.SetPower(false);
                });

            var mainSequence = new Sequence("Main Sequence");
            mainSequence.WhenExecuted
                .Execute(instance =>
                {
                    pulsatingEffect1.Stop();
                    pulsatingEffect2.Stop();
                    flickerEffect.Stop();
                    blinkyEyesLight.SetPower(false);
                    candyLight.SetColor(Color.Red);

                    audioPlayer.PauseBackground();
                    audioPlayer.PlayEffect("Door-creak");
                    instance.WaitFor(TimeSpan.FromSeconds(2));

                    instance.WaitFor(TimeSpan.FromSeconds(2));
                    candyPulse.Stop();
                    candyLight.SetStrobe(1, Color.White);
                    instance.WaitFor(TimeSpan.FromSeconds(0.5));
                    candyLight.TurnOff();
                    instance.WaitFor(TimeSpan.FromSeconds(1));

                    audioPlayer.PlayEffect("348 Spider Hiss");
                    instance.WaitFor(TimeSpan.FromSeconds(0.5));
                    spiderLight.SetStrobe(0.78, Color.Red);

                    spiderLift.SetPower(true);
                    spiderEyes.SetPower(true);

                    instance.WaitFor(TimeSpan.FromSeconds(1));
                    audioPlayer.PlayEffect("348 Spider Hiss");
                    instance.WaitFor(TimeSpan.FromSeconds(2));

                    // Spider up
                    audioPlayer.PlayEffect("Scream");
                    spiderLift.SetPower(false);
                    spiderEyes.SetPower(false);
                    smokeMachine.SetPower(true);

                    instance.WaitFor(TimeSpan.FromSeconds(2));
                    spiderLight.TurnOff();
                    audioPlayer.PlayEffect("Violin screech");
                    instance.WaitFor(TimeSpan.FromSeconds(2));

                    // Skeleton to the right
            //                    audioPlayer.PlayEffect("Ghostly");
                    rgbLightRight.SetStrobe(0.78, Color.Violet);
                    instance.WaitFor(TimeSpan.FromMilliseconds(1000));
                    rgbLightRight.SetColor(Color.Red);
                    instance.WaitFor(TimeSpan.FromMilliseconds(1000));
                    rgbLightRight.SetColor(Color.Blue);
                    instance.WaitFor(TimeSpan.FromSeconds(2));
                    rgbLightRight.TurnOff();
                    instance.WaitFor(TimeSpan.FromSeconds(1));

                    // Skeleton to the left
                    audioPlayer.PlayEffect("death-scream");
                    instance.WaitFor(TimeSpan.FromSeconds(0.5));
                    leftSkeletonLight.SetStrobe(0.78, Color.Pink);
                    instance.WaitFor(TimeSpan.FromSeconds(3));
                    smokeMachine.SetPower(false);
                    instance.WaitFor(TimeSpan.FromSeconds(1));
                    leftSkeletonLight.TurnOff();

                    // George
                    audioPlayer.PlayEffect("Laugh");
                    instance.WaitFor(TimeSpan.FromMilliseconds(800));
                    georgeMotor.SetVector(1.0, 160, TimeSpan.FromSeconds(5));
                    georgeStrobeLight.SetStrobe(0.55, 1.0);
                    georgeLight.SetStrobe(0.78, Color.Brown);

                    georgeMotor.WaitForVectorReached();
                    instance.WaitFor(TimeSpan.FromSeconds(2));
                    georgeStrobeLight.TurnOff();
                    georgeLight.TurnOff();

                    candyPulse.MinBrightness = 0.05;
                    candyPulse.MaxBrightness = 1.0;
                    candyLight.SetColor(Color.Violet);
                    candyPulse.Start();
                    georgeMotor.SetVector(0.9, 0, TimeSpan.FromSeconds(6));
                    georgeMotor.WaitForVectorReached();

                    blinkyEyesLight.SetPower(true);

                    flickerEffect.Start();
                    pulsatingEffect1.Start();

                    instance.WaitFor(TimeSpan.FromSeconds(5));
                    smokeMachine.SetPower(true);

                    audioPlayer.PlayBackground();
                    // Wait for reset
                    instance.WaitFor(TimeSpan.FromSeconds(15));
                    pulsatingEffect2.Start();
                    candyPulse.MinBrightness = 0.01;
                    candyPulse.MaxBrightness = 0.1;
                    candyLight.SetColor(Color.Green);
                    smokeMachine.SetPower(false);
                });

            pressureMat.ActiveChanged += (sender, e) =>
            {
                if (e.NewState)
                {
                    if(hours.IsOpen)
                        Executor.Current.Execute(mainSequence);
                    else
                        audioPlayer.PlayEffect("Laugh");
                }
            };

            testButton.ActiveChanged += (sender, e) =>
                {
                    if (e.NewState)
                        Executor.Current.Execute(mainSequence);
                };

            hours.OpenHoursChanged += (sender, e) =>
                {
                    if (e.IsOpenNow)
                    {
                        pulsatingEffect1.Start();
                        pulsatingEffect2.Start();
                        flickerEffect.Start();
                        candyPulse.Start();
                        blinkyEyesLight.SetPower(true);
                        audioPlayer.PlayBackground();
                    }
                    else
                    {
                        pulsatingEffect1.Stop();
                        pulsatingEffect2.Stop();
                        flickerEffect.Stop();
                        candyPulse.Stop();
                        blinkyEyesLight.SetPower(false);
                        audioPlayer.PauseBackground();
                    }
                };

            // Have it turned off, but prepare it with blue color for the effect
            rgbLightRight.SetColor(Color.Blue, 0);
            candyLight.SetColor(Color.Green, 0);
            pulsatingEffect1.AddDevice(rgbLightRight);
            pulsatingEffect2.AddDevice(cobWebLight);
            candyPulse.AddDevice(candyLight);

            flickerEffect.AddDevice(skullsLight);
        }