コード例 #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);
        }
コード例 #2
0
 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;
 }