Beispiel #1
0
 public void OnPointerDown(PointerEventData eventData)
 {
     if (resourceController.HasEnoughResources(woodCost, goldCost, foodCost) && populationController.HasSufficientWorkers(villagerCost))
     {
         audioSource.PlayOneShot(buildSound);
         resourceController.UseResources(woodCost, goldCost, foodCost);
         populationController.ConscriptPopulation(villagerCost);
         heldBuilding              = buildMenuController.SpawnSelectedBuilding(iconID);
         boxCollider               = heldBuilding.GetComponent <BoxCollider2D>();
         holdingBuilding           = true;
         cameraMove.CanMove        = false;
         gameController.isBuilding = true;
     }
     else
     {
         audioSource.PlayOneShot(cantBuildSound);
         cameraMove.CanMove        = false;
         gameController.isBuilding = true;
     }
 }