예제 #1
0
 public void BuildHouse()
 {
     if (script.resourceAvailable >= costOfHouse)
     {
         script.resourceAvailable = script.resourceAvailable - costOfHouse;
         script.numberOfHouses++;
         script.maxPopulation = script.numberOfHouses * 4;
         script.UpdateGUI();
         UpdateGUI();
         AudioClips[0].Play();
         AudioClips[1].Play();
         GameObject building = Instantiate(house, new Vector3(-633.6107f, -321.2444f, -10f), Quaternion.Euler(0, 0, Random.Range(0, 360)));
         building.transform.SetParent(toBuildIn, false);
     }
 }
예제 #2
0
 public void BuildItem()
 {
     if (script.resourceAvailable >= costOfItem)
     {
         if (item == "Mines")
         {
             script.numberOfMines++;
         }
         else if (item == "Farms")
         {
             script.numberOfFarms++;
         }
         else
         {
             script.numberOfGas++;
         }
         AudioClips[0].Play();
         PlaceItem();
         script.resourceAvailable = script.resourceAvailable - costOfItem;
         script.UpdateGUI();
         UpdateGUI();
     }
 }