public PlacementController(PlayerObjectPool playerObjectPool, BuildChoiceUpdater buildChoiceUpdater) { buildingManagers = new List <IBuildingManager>(); this.playerObjectPool = playerObjectPool; this.buildChoiceUpdater = buildChoiceUpdater; mainCamera = Camera.main; }
public ContextProvider(MonoBehaviour behaviour, PlayerObjectPool playerObjectPool, BuildChoiceUpdater buildChoiceUpdater, InfantryManager infantryManager) { this.behaviour = behaviour; this.playerObjectPool = playerObjectPool; this.buildChoiceUpdater = buildChoiceUpdater; this.infantryManager = infantryManager; }
void Start() { ContextProvider context; playerObjectPool = new PlayerObjectPool(); BuildChoiceUpdater buildChoiceUpdater = new BuildChoiceUpdater(); placementController = new PlacementController(playerObjectPool, buildChoiceUpdater); UnitBuildChoiceProvider unitBuildChoiceProvider = new UnitBuildChoiceProvider(placementController); InfantryManager infantryManager = new InfantryManager(unitBuildChoiceProvider); context = new ContextProvider(this, playerObjectPool, buildChoiceUpdater, infantryManager); selectionController = new SelectionController(context); selectedGroupController = new SelectedGroupController(context); IBuildingManager playerBaseManager = new PlayerBaseManager(context); placementController.RegisterBuildingManager(playerBaseManager); playerObjectPool.RegisterSelectableObjectContainer(playerBaseManager); unitBuildChoiceProvider.RegisterBloodBuildable(playerBaseManager); IBuildingManager barracksManager = new BarracksManager(context); placementController.RegisterBuildingManager(barracksManager); playerObjectPool.RegisterSelectableObjectContainer(barracksManager); unitBuildChoiceProvider.RegisterBloodBuildable(barracksManager); playerObjectPool.RegisterSelectableObjectContainer(infantryManager); Camera.main.gameObject.AddComponent <PCCameraController>(); GameObject hud = SetupHUD(); PlayerResources.GetInstance().RegisterListener(hud.GetComponent <BloodCounterHUD>()); PlayerResources.GetInstance().RegisterListener(buildChoiceUpdater); buildChoiceUpdater.RegisterBuildChoiceChangeListener(hud.GetComponent <ActionsMenuHUD>()); }