示例#1
0
        public MathGameSystem(GameRunner game, SharperInputSystem input) : base(game)
        {
            _game   = game;
            _input  = input;
            _random = new Random();

            _input.NewInputEntityCreated += async(s, e) =>
            {
                await RegisterComponentAsync(new MathGameComponent(await game.CreateEntityAsync(), e.Entity));

                _inputEntity = e.Entity;
            };
        }
示例#2
0
        public LocationSystem(GameRunner game, SharperInputSystem inputSystem) : base(game)
        {
            _inputSystem = inputSystem;

            foreach (var location in GameConfig.Locations.Values)
            {
                var  locationEntity   = game.CreateEntityAsync().GetAwaiter().GetResult();
                bool startingLocation = false;
                if (location.ID == GameConfig.StartingLocationID)
                {
                    startingLocation = true;
                }

                RegisterComponentAsync(locationEntity, location, location.ExplorableLocations.ToDictionary(x => GameConfig.Locations[x].Name, x => x), startingLocation);
            }

            //how to do this without console...
            Console.WriteLine(GameConfig.InitialGameMessage);
        }