Vtj.Contest.Race.RaceLevel.Update C# (CSharp) Method

Update() protected method

protected Update ( System.Html.Media.Graphics.CanvasContext2D context ) : void
context System.Html.Media.Graphics.CanvasContext2D
return void
        protected override void Update(CanvasContext2D context)
        {
            if (Status != RaceStatus.Fail && Status != RaceStatus.Win)
            {
                context.DrawImage(_timeLeftFrame, 308, 10);

                Type.SetField(context, "textAlign", "right");
                context.FillStyle = "#00AD11";

                if (TimeLeft > 10000 || Math.Floor((TimeLeft / 300) % 2) != 0)
                {
                    if (TimeLeft < 0) TimeLeft = 0;
                    context.Font = "110px Digital";
                    context.FillText(Math.Floor(TimeLeft / 1000).ToString(), 475, 105);
                }

                if (Speed > 0)
                {
                    context.Save();
                    context.Scale(-1, 1);
                    long width = Math.Floor((10 * Speed) / MaxSpeed) * 22;
                    if (width > 0) context.DrawImage(_meterImage, 220 - width, 0, width, 102, -561 - width, 20, width, 102);
                    context.Restore();
                }

                context.Font = "30px Digital";
                context.FillText(Math.Floor(Speed * 5) + " Km/h", 780, 120);

                int rpmWidth = Math.Floor(_rpm / 500) * 22 + 22;

                context.DrawImage(_meterImage, 220 - rpmWidth, 0, rpmWidth, 102, 240 - rpmWidth, 20, rpmWidth, 102);
                context.FillText(Math.Floor(_rpm) + " RPM", 130, 120);

                context.BeginPath();
                context.LineWidth = 3;
                context.StrokeStyle = "#00AD11";
                context.MoveTo(5, 150);
                float x = 5 + Math.Min(Position * 735 / RoadLength, 735);
                context.LineTo(x, 150);
                context.Stroke();
                context.ClosePath();

                context.BeginPath();
                context.StrokeStyle = "#006808";
                context.MoveTo(x, 150);
                context.LineTo(790, 150);
                context.Stroke();
                context.ClosePath();
                context.DrawImage(_markerImage, x, 142);
            }

            if (Status == RaceStatus.Running)
            {
                TimeLeft -= DeltaTime;

                if (TimeLeft < 0)
                {
                    _music.Pause();
                    CarSystem.CarObject.CurrentAnimation = "Forward";
                    Status = RaceStatus.Fail;
                    ShowMessage(_failMessage);
                    RemoveSystem(_engineSoundSystem);
                    RemoveSystem(_npcSystem);
                    pendingTimers.Add(Window.SetTimeout(delegate()
                    {
                        UpdateMessage("<p>Press a key to continue.</p>");
                    }, 3000));
                }
            }
        }