Exemple #1
0
        public virtual void Update(DeviceContext context, TargetBase target, DeviceManager deviceManager, Point screenSize, float dt, float elapsedTime)
        {
            context.DrawRectangle(screenSize.ApplyTo(GamesParams.Margin0.ToRectangleWith(GamesParams.Margin1)), GamesParams.ObstaclesColor, 2);

            _gameTime += dt;

            if (!_gameManager.IsTraining)
            {
                const float u = 1.00f;
                if (_gameTime < u && !AfterStartFreeze)
                {
                    var op = 1 - _gameTime / u;
                    var hideBrush = new SolidColorBrush(deviceManager.ContextDirect2D, Colors.White,
                                                        new BrushProperties { Opacity = op });
                    context.FillRectangle(screenSize.ApplyTo(new RectangleF(0, 0, 1, 1)), hideBrush);
                }
                else
                {
                    AfterStartFreeze = true;
                }

                if (_gameTime > _gameMaxTime - u)
                {
                    var op = 1 - (_gameMaxTime - _gameTime) / u;
                    var hideBrush = new SolidColorBrush(deviceManager.ContextDirect2D, Colors.White,
                                                        new BrushProperties { Opacity = op });
                    context.FillRectangle(screenSize.ApplyTo(new RectangleF(0, 0, 1, 1)), hideBrush);
                }

                float bar;
                bar = _gameManager.IsTraining ? 1 : _gameTime / _gameMaxTime;
                _gameManager.Page.SetTimeRectangleWidth(bar);
                _gameManager.RedrawPointsAndLifes();

                if (_gameTime > _gameMaxTime)
                    _gameManager.Win(100);
            }
        }
Exemple #2
0
 public override void Draw(Direct2D.DeviceContext renderTarget, Direct2D.Brush brush) => renderTarget.DrawRectangle(Rect, brush);
Exemple #3
0
 public void DrawRectangle(Shape shape, Brush brush, float strokeThickness = 1.0f)
 {
     deviceContext.DrawRectangle(Convert(shape.BoundingRectangle), brush, strokeThickness);
 }