Beispiel #1
0
        IEnumerator <WaitCommand> NotifyAboutParachute()
        {
            yield return(WaitCommand.Wait(30.Seconds()));

            if (_unfoldParachuteMappingStr != null)
            {
                _data.NotificationList.AddTimedNotification("Did you know you can press <i>" + _unfoldParachuteMappingStr + "</i> to open your parachute?", 10.Seconds());
                _openParachuteNotification = Disposables.Empty;
            }
        }
Beispiel #2
0
        static IEnumerator <WaitCommand> Subroutine(bool hasSubroutine, string prefix)
        {
            yield return(WaitCommand.Wait(5f.Seconds()));

            if (hasSubroutine)
            {
                yield return(WaitCommand.Interleave(
                                 Subroutine(false, prefix + prefix),
                                 Subroutine(false, prefix + prefix + "2")));
            }
            yield return(WaitCommand.DontWait);

            Console.WriteLine(prefix + " subroutine");
        }
    public IEnumerator <WaitCommand> Animate(Transform mount, Predicate isRunning)
    {
        var pathSelection = _cameraPaths.Paths;
        var selectedPath  = pathSelection.RandomElement();
        var isFirst       = true;

        while (isRunning())
        {
            selectedPath = pathSelection.GetNext(selectedPath);

            if (_gameSettingsProvider.IsVrActive)
            {
                selectedPath = new StaticCameraPath(
                    Routines.LinearAnimation,
                    selectedPath.Duration,
                    selectedPath.To,
                    to: selectedPath.To);
            }

            IEnumerator <WaitCommand> fadeIn;
            if (isFirst)
            {
                fadeIn  = WaitCommand.DontWait.AsRoutine;
                isFirst = false;
            }
            else
            {
                fadeIn = _rig.ScreenFader.FadeIn(_clock, _faderSettings);
            }

            var fadeOut = WaitCommand.Wait(selectedPath.Duration - _faderSettings.FadeOutDuration)
                          .AndThen(_rig.ScreenFader.FadeOut(_clock, _faderSettings));

            var cameraAnimation = CameraAnimator.Animate(mount, selectedPath, _clock);

            yield return(WaitCommand
                         .Interleave(fadeIn, cameraAnimation, fadeOut)
                         .RunWhile(isRunning)
                         .AsWaitCommand());
        }
        _rig.ScreenFader.Opacity = 0f;
    }
Beispiel #4
0
        static IEnumerator <WaitCommand> SimpleRoutine()
        {
            yield return(WaitCommand.WaitForNextFrame);

            Console.WriteLine("jaja");
            yield return(WaitCommand.Wait(1f.Seconds()));

            Console.WriteLine("jaja2");

            yield return(WaitCommand.Interleave(
                             WaitCommand.Wait(20.Seconds()).AsRoutine,
                             Subroutine(false, "aa"),
                             Subroutine(true, "bb"),
                             Subroutine(false, "cc")));

            Console.WriteLine("first");
            yield return(WaitCommand.Wait(1f.Seconds()));

            Console.WriteLine("second");
            yield return(WaitCommand.Wait(1f.Seconds()));
        }