public HalloweenFlying(
            Dimmer3 eyes,
            ThroughputDevice fogStairsPump1,
            ThroughputDevice fogStairsPump2,
            StrobeColorDimmer3 fogStairsLight1,
            StrobeColorDimmer3 fogStairsLight2,
            AudioPlayer audioPlayer,
            [System.Runtime.CompilerServices.CallerMemberName] string name = "")
            : base(name)
        {
            pulsatingLow.ConnectTo(eyes);

            OutputPower.Subscribe(x =>
            {
                if (x)
                {
                    LockDevices(eyes);

                    pulsatingLow.Start(token: this.controlToken);
                }
                else
                {
                    pulsatingLow.Stop();
                    UnlockDevices();
                }
            });

            PowerOn
            .RunAction(ins =>
            {
                pulsatingLow.Stop();

                eyes.SetBrightness(1);
                audioPlayer.PlayEffect("Who is that knocking.wav");

                ins.WaitFor(S(2.5));

                fogStairsPump1.SetThroughput(0.4);
                fogStairsLight1.SetColor(Color.Purple, 1.0);

                fogStairsPump2.SetThroughput(0.4);
                fogStairsLight2.SetColor(Color.Purple, 1.0);

                ins.WaitFor(S(1.0));

                fogStairsPump1.SetThroughput(0);
                fogStairsPump2.SetThroughput(0);

                ins.WaitFor(S(1.0));
                fogStairsLight1.SetBrightness(0);
                fogStairsLight2.SetBrightness(0);
            })
            .TearDown(ins =>
            {
                pulsatingLow.Start(token: this.controlToken);
            });
        }
Example #2
0
        public HalloweenSpiderDrop(
            IReceivesBrightness eyesLight,
            IReceivesBrightness smallSpiderEyes,
            DigitalOutput2 drop,
            DigitalOutput2 venom,
            StrobeDimmer3 strobeLight,
            AudioPlayer audioPlayer,
            [System.Runtime.CompilerServices.CallerMemberName] string name = "")
            : base(name)
        {
            pulsating.ConnectTo(smallSpiderEyes);

            OutputPower.Subscribe(x =>
            {
                if (x)
                {
                    LockDevices(drop, venom, eyesLight, strobeLight, smallSpiderEyes);

                    pulsating.Start(token: this.controlToken);
                }
                else
                {
                    pulsating.Stop();
                    UnlockDevices();
                }
            });

            PowerOn.RunAction(ins =>
            {
                pulsating.Stop();
                audioPlayer.PlayNewEffect("348 Spider Hiss.wav", 0, 1);
                eyesLight.SetBrightness(1);
                drop.SetValue(true);
                ins.WaitFor(S(0.2));
                strobeLight.SetBrightnessStrobeSpeed(1, 1);
                venom.SetValue(true);
                ins.WaitFor(S(2.0));
                venom.SetValue(false);
                strobeLight.SetBrightnessStrobeSpeed(0, 0);
                ins.WaitFor(S(2.0));
            })
            .TearDown(ins =>
            {
                drop.SetValue(false);
                venom.SetValue(false);
                eyesLight.SetBrightness(0);
                strobeLight.SetBrightnessStrobeSpeed(0, 0);
                pulsating.Start(token: this.controlToken);
                ins.WaitFor(S(1.0));
            });
        }
Example #3
0
        public HalloweenMrPumpkin(
            Dimmer3 light,
            DigitalOutput2 air,
            AudioPlayer audioPlayer,
            [System.Runtime.CompilerServices.CallerMemberName] string name = "")
            : base(name)
        {
            pulsatingLow.ConnectTo(light);
            levelsPlayback.Output.Controls(b => light.SetBrightness(b, this.controlToken));

            OutputPower.Subscribe(x =>
            {
                if (x)
                {
                    LockDevices(air, light);

                    air.SetValue(true, this.controlToken);
                    pulsatingLow.Start(token: this.controlToken);
                }
                else
                {
                    pulsatingLow.Stop();
                    UnlockDevices();
                }
            });

            PowerOn
            .RunAction(ins =>
            {
                pulsatingLow.Stop();

                audioPlayer.PlayEffect("125919__klankbeeld__horror-what-are-you-doing-here-cathedral.wav", levelsPlayback);
                levelsPlayback.Start(this.controlToken);

                ins.WaitFor(S(8));
            })
            .TearDown(ins =>
            {
                pulsatingLow.Start(token: this.controlToken);
            });
        }
Example #4
0
        public HalloweenRocker(
            DigitalOutput2 rockingMotor,
            DigitalOutput2 ladyEyes,
            StrobeColorDimmer3 strobeLight,
            AudioPlayer audioPlayer,
            [System.Runtime.CompilerServices.CallerMemberName] string name = "")
            : base(name)
        {
            pulsatingRocking.ConnectTo(strobeLight, Utils.Data(DataElements.Color, Color.HotPink));

            OutputPower.Subscribe(x =>
            {
                if (x)
                {
                    LockDevices(rockingMotor, ladyEyes, strobeLight);
                    audioPlayer.SetBackgroundVolume(0.2);
                    audioPlayer.PlayBackground();
                    sub.Run();
                }
                else
                {
                    audioPlayer.PauseBackground();
                    UnlockDevices();
                    Exec.Cancel(sub);
                }
            });

            sub
                .SetUp(ins =>
                {
                    ladyEyes.SetValue(true, this.controlToken);
                    rockingMotor.SetValue(true, this.controlToken);
                })
                .RunAction(ins =>
                {
                    while (!ins.IsCancellationRequested)
                    {
                        isRockingLadyTalking = true;
                        audioPlayer.PlayEffect("A conversation with Mother.wav");
                        ins.WaitFor(S(42), true);
                        isRockingLadyTalking = false;

                        ins.WaitFor(S(15.0));
                    }
                })
                .TearDown(ins =>
                {
                    audioPlayer.PauseFX();
                    ladyEyes.SetValue(false, this.controlToken);
                    rockingMotor.SetValue(false, this.controlToken);
                });

            PowerOn.RunAction(ins =>
                {
                    pulsatingRocking.Start(token: this.controlToken);
                    if (!isRockingLadyTalking)
                    {
                        switch (random.Next(3))
                        {
                            case 0:
                                audioPlayer.PlayEffect("032495843-old-woman-cough.wav");
                                break;

                            case 1:
                                audioPlayer.PlayEffect("049951942-grampy-old-woman-cackle.wav");
                                break;

                            case 2:
                                audioPlayer.PlayEffect("053851373-old-ungly-female-laughter.wav");
                                break;
                        }
                    }

                    ins.WaitFor(S(7));
                })
                .TearDown(ins =>
                {
                    pulsatingRocking.Stop();
                });
        }