Inheritance: MonoBehaviour
        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);
            });
        }
        public HalloweenFrankGhost(
            IReceivesColor 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);
                    light.SetColor(Color.Red, this.controlToken);
                    pulsatingLow.Start(token: this.controlToken);
                }
                else
                {
                    pulsatingLow.Stop();

                    UnlockDevices();
                }
            });

            PowerOn
            .SetLoop(true)
            .SetMaxRuntime(S(60))
            .SetUp(ins =>
            {
                pulsatingLow.Stop();
            })
            .RunAction(ins =>
            {
                audioPlayer.PlayEffect("Thriller2.wav", levelsPlayback);
                // The control token is optional since it's passed in via the Subroutine
                light.SetColor(Color.Purple);
                var cts = levelsPlayback.Start(this.controlToken);

                ins.WaitFor(S(45));
                cts.Cancel();
            })
            .TearDown(ins =>
            {
                light.SetColor(Color.Red);
                pulsatingLow.Start(token: this.controlToken);
            });

            PowerOff.RunAction(ins =>
            {
                audioPlayer.PlayEffect("Happy Halloween.wav", 0.15);
                ins.WaitFor(S(5));
            });
        }
示例#3
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));
            });
        }
示例#4
0
 public HalloweenPictureFrame(
     CommandDevice medeaWizPlayer,
     [System.Runtime.CompilerServices.CallerMemberName] string name = "")
     : base(name)
 {
     PowerOn
     .SetLoop(true)
     .SetMaxRuntime(S(60))
     .RunAction(ins =>
     {
         medeaWizPlayer.SendCommand(this.controlToken, 99);
         ins.WaitFor(S(10));
     })
     .TearDown(ins =>
     {
         medeaWizPlayer.SendCommand(this.controlToken, 255);
     });
 }
示例#5
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);
            });
        }
示例#6
0
 public void OnPowerOn()
 {
     PowerOn?.Invoke();
     GetApp <LoggerApp>("Logs").OnUpdate("Phone On");
 }
示例#7
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();
                });
        }
示例#8
0
        public HalloweenGrumpyCat(
            Dimmer3 light,
            DigitalOutput2 air,
            AudioPlayer audioPlayer,
            [System.Runtime.CompilerServices.CallerMemberName] string name = "")
            : base(name)
        {
            pulsatingLow.ConnectTo(light);
            pulsatingHigh.ConnectTo(light);

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

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

            PowerOn
            .SetLoop(true)
            .SetMaxRuntime(S(20))
            .SetUp(ins =>
            {
                pulsatingLow.Stop();
                pulsatingHigh.Start(token: this.controlToken);
            })
            .RunAction(ins =>
            {
                switch (random.Next(5))
                {
                case 0:
                    audioPlayer.PlayEffect("266 Monster Growl 7.wav", 1.0, 1.0);
                    ins.WaitFor(S(2.0));
                    break;

                case 1:
                    audioPlayer.PlayEffect("285 Monster Snarl 2.wav", 1.0, 1.0);
                    ins.WaitFor(S(3.0));
                    break;

                case 2:
                    audioPlayer.PlayEffect("286 Monster Snarl 3.wav", 1.0, 1.0);
                    ins.WaitFor(S(2.5));
                    break;

                case 3:
                    audioPlayer.PlayEffect("287 Monster Snarl 4.wav", 1.0, 1.0);
                    ins.WaitFor(S(1.5));
                    break;

                default:
                    ins.WaitFor(S(3.0));
                    break;
                }
            })
            .TearDown(ins =>
            {
                //TODO: Fade out
                pulsatingHigh.Stop();
                pulsatingLow.Start(token: this.controlToken);
            });


            PowerOff
            .RunAction(ins =>
            {
                audioPlayer.PlayEffect("How you doing.wav", 0.15);
                ins.WaitFor(S(5));
            });
        }