public override Task Run(IGameContext context, CancellationToken token)
 {
     _map = _mapLoader.Load("Levels", "*.cshtml").First();
     _eventSink.Subscribe <ConsoleKeyPressedEvent>(new MovementHandler(_gameState).Handle);
     _eventSink.Subscribe <PelletEaten>(new FoodMonitorHandler(_map, this).Handle);
     _eventSink.Subscribe <CherryEaten>(new FoodMonitorHandler(_map, this).Handle);
     _renderer.Render(_map.ToSprite(new Offset(0, 0)));
     _lastUpdateTime = DateTime.Now;
     return(base.Run(context, token));
 }
示例#2
0
        public void Render(ISprite source)
        {
            if (_previous == null)
            {
                _renderer.Render(source);
            }
            else
            {
                ISprite differenceView = _previous.GetBitmapDifference(source, Color.Black);
                _renderer.Render(differenceView);
            }

            _previous = source;
        }