public override void Begin(ILightingController controller, Random random)
                {
                    _currentStep = 0;

                    _on = new PatternConfigured
                    {
                        Configured = new[] { Color.Green }
                    };
                    _on.Reset(controller, random);

                    _off = new PatternConfigured
                    {
                        Configured = new[] { Color.Red }
                    };
                    _off.Reset(controller, random);

                    _animation = new AnimationInstant();
                    var totalSteps = _animation.Begin(controller, _on, random);

                    _timing = new TimingConstant
                    {
                        Milliseconds = 500
                    };
                    _timing.Reset(totalSteps);
                }
Beispiel #2
0
        public override void Begin(ILightingController controller, Random random)
        {
            var nextPattern = _patternFactory.GenerateRandom(random);

            if (_currentPattern != null)
            {
                int i = 0;
                while (i < 10 && _currentPattern.GetType() == typeof(PatternClear) && nextPattern.GetType() == typeof(PatternClear))
                {
                    nextPattern = _patternFactory.GenerateRandom(random);
                    i++;
                }

                // TODO : Remove this?
                // NOTE : Temporary implementation to prevent unlit/black colour being used in succession
                if (i >= 9)
                {
                    nextPattern = new PatternRandomSolidColor();
                }
            }

            _currentPattern   = nextPattern;
            _currentTiming    = _timingFactory.GenerateRandom(random);
            _currentAnimation = _animationFactory.GenerateRandom(random);

            _currentPattern.Reset(controller, random);
            var totalSteps = _currentAnimation.Begin(controller, _currentPattern, random);

            _currentTiming.Reset(totalSteps);
        }
        public override sealed void Begin(ILightingController controller, Random random)
        {
            _pattern = CreatePattern();
            _pattern.Reset(controller, random);
            _animation = CreateAnimation();
            var totalSteps = _animation.Begin(controller, _pattern, random);

            _timing = CreateTiming();
            _timing.Reset(totalSteps);
        }