Example #1
0
 public InfantryManager(UnitBuildChoiceProvider unitBuildChoiceProvider)
 {
     placementHotkey              = GameController.GetHotkeys().GetInfantryBuildHotkey();
     unitProductionSprite         = Resources.Load <Sprite>(GameController.GetGlobalTheme().GetInfantryActionsMenuSpritePath());
     this.unitBuildChoiceProvider = unitBuildChoiceProvider;
     this.infantryPool            = new ObjectPool <Unit>(() => InternalCreateUnit(), (i) => InternalActivateUnit(i), (i) => InternalDeactivateUnit(i));
 }
    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>());
    }
Example #3
0
 public Infantry(InfantryManager infantryManager, UnitBuildChoiceProvider unitBuildChoiceProvider) : base(infantryManager, unitBuildChoiceProvider)
 {
     prefabPath = GameController.GetGlobalTheme().GetInfantryPrefabPath();
 }