public void Load() { Transform pParent = transform; // Prefabs for (int i = 0; i < 100; ++i) { // tree GameObject goTree = Instantiate(prefabTree); TreeHandler treeHandler = goTree.GetComponent <TreeHandler>(); treeHandler.Load(pParent); treeObjectPool.Enqueue(goTree); // stone GameObject goStone = Instantiate(prefabStone); StoneHandler stoneHandler = goStone.GetComponent <StoneHandler>(); stoneHandler.Load(pParent); stoneObjectPool.Enqueue(goStone); // food GameObject goFood = Instantiate(prefabFood); FoodHandler foodHandler = goFood.GetComponent <FoodHandler>(); foodHandler.Load(pParent); foodObjectPool.Enqueue(goFood); } // Preloads PlayController pc = PlayController.main; BuildingsHandler buildingsHandler = buildingsHandlerObject.GetComponent <BuildingsHandler>(); buildingsHandler.Load(); // houses BuildingClicker houseClicker = houseSmallClickerObject.GetComponent <BuildingClicker>(); houseClicker.Load(pc.gameData.houseSmallResourceCost); houseClicker = houseMediumClickerObject.GetComponent <BuildingClicker>(); houseClicker.Load(pc.gameData.houseMediumResourceCost); houseClicker = houseLargeClickerObject.GetComponent <BuildingClicker>(); houseClicker.Load(pc.gameData.houseLargeResourceCost); // resources BuildingClicker satisfactionClicker = farmClickerObject.GetComponent <BuildingClicker>(); satisfactionClicker.Load(pc.gameData.farmResourceCost); BuildingClicker resourceClicker = foresterClickerObject.GetComponent <BuildingClicker>(); resourceClicker.Load(pc.gameData.foresterResourceCost); resourceClicker = quarryClickerObject.GetComponent <BuildingClicker>(); resourceClicker.Load(pc.gameData.quarryResourceCost); // satisfaction resourceClicker = cemeteryClickerObject.GetComponent <BuildingClicker>(); resourceClicker.Load(pc.gameData.cemeteryResourceCost); satisfactionClicker = clinicClickerObject.GetComponent <BuildingClicker>(); satisfactionClicker.Load(pc.gameData.clinicResourceCost); satisfactionClicker = tavernClickerObject.GetComponent <BuildingClicker>(); satisfactionClicker.Load(pc.gameData.tavernResourceCost); OnLoadComplete?.Invoke(); }
private void PlayBuildingsEnter() { BuildingsHandler buildingsHandler = gameObjectFactory.buildingsHandlerObject.GetComponent <BuildingsHandler>(); buildingsHandler.PlayEnter(); }