private void InstallDIContainer() { // initialise the di container and installers container = new DiContainer(); CoreServicesInstaller.Install(container); GameServiceInstaller.Install(container); GameSystemInstaller.Install(container); }
public void SpawnSingleObject() { if (!string.IsNullOrEmpty(_objectId)) { var commandSystem = GameSystemInstaller.Resolve <CommandSystem>(); var gridService = GameServiceInstaller.Resolve <GridService>(); var command = new CommandData(); command.type = Constants.COMMAND_SPAWN_OBJ; command.output = _objectId; command.count = 1; var cell = gridService.GetClosestCell(Vector3.zero, true); if (cell != null) { commandSystem.Execute(command, cell.position, cell); } } }
public override void InstallBindings() { JamStateFactory gameStateInstaller = Container.Instantiate <JamStateFactory>(); gameStateInstaller.InstallBindings(); GameSystemInstaller gameSystemsInstaller = Container.Instantiate <GameSystemInstaller>(); gameSystemsInstaller.InstallBindings(); Container.Bind <IEventDispatcher>().WithId(GLOBAL_DISPATCHER).To <EventDispatcher>().AsSingle(); //Container.Bind<GameState>().AsSingle(); //Container.Bind<GameTimerManager>().AsSingle(); //Container.Bind<WaveAISystem>().AsSingle(); //Container.Bind<CreepViewSystem>().AsSingle(); //Container.Bind<WaveSpawnerSystem>().AsSingle(); //Container.Bind<GameSystemManager>().AsSingle(); //Container.Bind<CreepSystem>().AsSingle(); //Container.Bind<TowerSystem>().AsSingle(); //Container.Bind<TowerDictionary>().FromInstance(towerDictionary).AsSingle(); //Container.Bind<CreepDictionary>().FromInstance(creepDictionary).AsSingle(); //Container.Bind<CreepHealthUISystem>().FromNewComponentOnNewGameObject().AsSingle(); //Container.BindFactory<string, TowerSpawnInfo, Tower, Tower.Factory>(); //Container.BindFactory<string, CreepSpawnInfo, Creep, Creep.Factory>(); //Container.BindFactory<SyncStepper, SyncStepper.Factory>().WithFactoryArguments<GameObject>(syncCommanderPrefab); //Container.Bind<IStateFactory<JameStateType>>().To<JamStateFactory>().FromInstance(gameStateInstaller).AsSingle(); Container.Bind <SessionFlags>().AsSingle(); Container.Bind <GameConfig>().FromInstance(gameConfig).AsSingle(); Container.Bind <GameplayResources>().FromInstance(gameplayResources).AsSingle(); Container.BindInterfacesAndSelfTo <GuiManager>().AsSingle(); Container.BindInterfacesAndSelfTo <GameStateMachine <JamStateType> >().AsSingle().WithArguments(gameStateInstaller); Container.BindInterfacesAndSelfTo <NetworkManager>().FromNewComponentOnNewGameObject().AsSingle(); Container.BindInterfacesAndSelfTo <Singleton>().AsSingle(); }