예제 #1
0
 public TestSystem(GameRunner game, SharperInputSystem inputSystem) : base(game)
 {
     _prevStates  = new Dictionary <TestComponent, bool>();
     _inputSystem = inputSystem;
     _inputSystem.NewInputEntityCreated += OnNewInputEntity;
     ComponentRegistered   += OnComponentRegistered;
     ComponentUnRegistered += OnComponentUnRegistered;
 }
예제 #2
0
        public MathGameSystem(GameRunner game, SharperInputSystem input) : base(game)
        {
            _game   = game;
            _input  = input;
            _random = new Random();

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

                _inputEntity = e.Entity;
            };
        }
예제 #3
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);
        }