Example #1
0
        public Game Create()
        {
            var gameTimeService        = new GameTimeService(30);
            var gameLoop               = new GameEventQueueService(gameTimeService);
            var terrainServiceStore    = new SectorGraphDescriptionStore();
            var terrainSnapshotBuilder = new TerrainSnapshotCompiler(terrainServiceStore);
            var terrainService         = new TerrainService(terrainServiceStore, terrainSnapshotBuilder);
            var entityService          = new EntityService();
            var statsCalculator        = new StatsCalculator();
            var pathfinderCalculator   = new PathfinderCalculator(terrainService, statsCalculator);
            var movementSystemService  = new MovementSystemService(entityService, gameTimeService, statsCalculator, terrainService, pathfinderCalculator);

            entityService.AddEntitySystem(movementSystemService);
            var gameLogicFacade = new GameLogicFacade(terrainService, movementSystemService);
            var gameInstance    = new Game {
                GameTimeService       = gameTimeService,
                GameEventQueueService = gameLoop,
                TerrainService        = terrainService,
                EntityService         = entityService,
                PathfinderCalculator  = pathfinderCalculator,
                MovementSystemService = movementSystemService,
                GameLogicFacade       = gameLogicFacade
            };

            gameInstance.Initialize();
            GameCreated?.Invoke(this, gameInstance);
            return(gameInstance);
        }
Example #2
0
        private Entity CreateTestEntity(DoubleVector3 initialPosition, float radius, float movementSpeed)
        {
            var entity = EntityService.CreateEntity();

            EntityService.AddEntityComponent(entity, new MovementComponent {
                WorldPosition = initialPosition,
                BaseRadius    = radius,
                BaseSpeed     = movementSpeed
            });
            return(entity);
        }
 public MovementSystemService(
     EntityService entityService,
     GameTimeService gameTimeService,
     StatsCalculator statsCalculator,
     TerrainService terrainService,
     PathfinderCalculator pathfinderCalculator
     ) : base(entityService, kComponentMask)
 {
     this.gameTimeService      = gameTimeService;
     this.statsCalculator      = statsCalculator;
     this.terrainService       = terrainService;
     this.pathfinderCalculator = pathfinderCalculator;
 }
Example #4
0
        public void Tick()
        {
            DebugProfiler.EnterTick(GameTimeService.Ticks);

            GameEventQueueService.ProcessPendingGameEvents(out var eventsProcessed);

            EntityService.ProcessSystems();

            DebugProfiler.LeaveTick();

            foreach (var debugger in Debuggers)
            {
                debugger.HandleFrameEnd(new FrameEndStatistics {
                    EventsProcessed = eventsProcessed
                });
            }

            GameTimeService.IncrementTicks();
        }
Example #5
0
 public StatusSystemService(EntityService entityService) : base(entityService, kComponentMask)
 {
 }
Example #6
0
 protected EntitySystemService(EntityService entityService, EntityComponentsMask requiredComponentsMask)
 {
     EntityService          = entityService;
     RequiredComponentsMask = requiredComponentsMask;
 }