コード例 #1
0
 void FixedUpdate()
 {
     //If Collector_Change is greater than zero and bool is true
     if (data_manager_script.Get_Collector_Change() > 0 && selected == true)
     {
         //Subtracts that worker from the employer slots
         data_manager_script.Change_Collector_Amount(-1);
         //Sets bool to true
         harvested = true;
         //Creates a time delay
         next_time = Time.time + add_time;
     }
     //If bool is true and time delay has run out
     if (harvested == true && Time.time > next_time)
     {
         //Checks to see if it will go over the maximum storage.
         if (data_manager_script.Check_Resources(4) + 10 <= data_manager_script.Get_Max_Storage())
         {
             //Add resources to inventory
             data_manager_script.Change_Resources(4, 10);
         }
         //Add one to the Collector_Amount
         data_manager_script.Change_Collector_Amount(1);
         //Destroys the gameobject
         Destroy(gameObject);
     }
 }