Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (placed)
     {
         if (RoadAccess)
         {
             if (!pause.GamePaused)
             {
                 if (eTime.NewMonth && resources.PlayerFood >= 25 && CurrentEmployees > 0)
                 {
                     resources.PlayerGold = resources.PlayerGold + CurrentEmployees;
                     resources.PlayerFood = resources.PlayerFood - 15;
                 }
                 if (CurrentEmployees < MaxEmployees && placed && eTime.NewMonth)
                 {
                     newWorkers = PopManager.RequestWorkers(1);
                     PopManager.EmployedPeople += newWorkers;
                     CurrentEmployees          += newWorkers;
                     Debug.Log("" + gameObject.GetComponent <Building> ().BuildingNum);
                     SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
                 }
             }
         }
         else
         {
             PopManager.EmployedPeople -= CurrentEmployees;
             CurrentEmployees           = 0;
             Debug.Log("" + gameObject.GetComponent <Building> ().BuildingNum);
             SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
         }
     }
 }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     if (placed)
     {
         if (RoadAccess)
         {
             if (!pause.GamePaused)
             {
                 if (eTime.NewMonth && CurrentEmployees > 0)
                 {
                     resources.PlayerWood = resources.PlayerWood + (int)((float)CurrentEmployees * .75);
                 }
                 if (CurrentEmployees < MaxEmployees && placed)
                 {
                     newWorkers = PopManager.RequestWorkers(1);
                     PopManager.EmployedPeople += newWorkers;
                     CurrentEmployees          += newWorkers;
                     SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
                 }
             }
         }
         else
         {
             PopManager.EmployedPeople -= CurrentEmployees;
             CurrentEmployees           = 0;
             SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
         }
     }
 }
Beispiel #3
0
 // Update is called once per frame
 void Update()
 {
     if (placed)
     {
         if (RoadAccess)
         {
             if (!pause.GamePaused)
             {
                 if (CurrentEmployees < MaxEmployees && placed)
                 {
                     newWorkers = PopManager.RequestWorkers(1);
                     PopManager.EmployedPeople += newWorkers;
                     CurrentEmployees          += newWorkers;
                     SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
                 }
             }
         }
         else
         {
             PopManager.EmployedPeople -= CurrentEmployees;
             CurrentEmployees           = 0;
             SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
         }
     }
 }
    IEnumerator GetWorkers()
    {
        int numNewWorkers   = 0;
        int unfilledWorkers = 0;

        while (true)
        {
            //Debug.Log("requesting workers");
            numNewWorkers   = popMgr.RequestWorkers(kMaxWorkers - numWorkers, numWorkers, unfilledWorkers);
            numWorkers      = numWorkers + numNewWorkers;
            unfilledWorkers = kMaxWorkers - numWorkers;
            yield return(new WaitForSeconds(1));
        }
    }
Beispiel #5
0
 // Update is called once per frame
 void Update()
 {
     if (finished)
     {
         Destroy(gameObject);
     }
     if (destroying)
     {
         gameObject.GetComponent <BoxCollider> ().center = new Vector3(0, 100, 0);
         finished = true;
     }
     else if (placed)
     {
         if (RoadAccess)
         {
             if (!pause.GamePaused)
             {
                 if (CurrentEmployees < MaxEmployees && placed)
                 {
                     newWorkers = PopManager.RequestWorkers(1);
                     PopManager.EmployedPeople += newWorkers;
                     CurrentEmployees          += newWorkers;
                     SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
                 }
                 if (placed && eTime.NewMonth)
                 {
                     if (CurrentEmployees > 0 && discontent.DiscontentAmmt >= 1)
                     {
                         discontent.DiscontentAmmt -= 1;
                     }
                 }
                 if (CurrentEmployees == 0)
                 {
                     gameObject.GetComponent <BoxCollider> ().center = new Vector3(0, 100, 0);
                 }
                 else
                 {
                     gameObject.GetComponent <BoxCollider> ().center = new Vector3(0, 0, 0);
                 }
             }
         }
         else
         {
             PopManager.EmployedPeople -= CurrentEmployees;
             CurrentEmployees           = 0;
             SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
             gameObject.GetComponent <BoxCollider> ().center = new Vector3(0, 100, 0);
         }
     }
 }
Beispiel #6
0
 // Update is called once per frame
 void Update()
 {
     if (finished)
     {
         Destroy(gameObject);
     }
     if (destroying)
     {
         gameObject.GetComponent <BoxCollider> ().center = new Vector3(0, 100, 0);
         finished = true;
     }
     else if (placed)
     {
         if (RoadAccess)
         {
             if (!pause.GamePaused)
             {
                 if (CurrentEmployees < MaxEmployees && placed)
                 {
                     newWorkers = PopManager.RequestWorkers(1);
                     PopManager.EmployedPeople += newWorkers;
                     CurrentEmployees          += newWorkers;
                     SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
                 }
                 if (placed && eTime.NewMonth)
                 {
                     resources.PlayerGold += (int)((float)PopManager.PlayerPopulation * ((float)CurrentEmployees / 10f) / 50f);
                 }
                 if (CurrentEmployees == 0)
                 {
                     gameObject.GetComponent <BoxCollider> ().center = new Vector3(0, 100, 0);
                 }
                 else
                 {
                     gameObject.GetComponent <BoxCollider> ().center = new Vector3(0, 0, 0);
                 }
             }
         }
         else
         {
             gameObject.GetComponent <BoxCollider> ().center = new Vector3(0, 100, 0);
             PopManager.EmployedPeople -= CurrentEmployees;
             CurrentEmployees           = 0;
             SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
         }
     }
 }
Beispiel #7
0
 // Update is called once per frame
 void Update()
 {
     if (!pause.GamePaused && placed)
     {
         if (eTime.NewMonth && (eTime.currentMonth >= 4 && eTime.currentMonth <= 11))
         {
             resources.PlayerFood += CurrentEmployees * 2;
         }
         if (CurrentEmployees < MaxEmployees && placed)
         {
             newWorkers = PopManager.RequestWorkers(1);
             PopManager.EmployedPeople += newWorkers;
             CurrentEmployees          += newWorkers;
             SaveFileControl.control.buildings [gameObject.GetComponent <Building> ().BuildingNum, 4] = CurrentEmployees;
         }
     }
 }