I’m trying to create a bar which increases based upon time. So for example I might want it to be completely filled within 1 second of 1/2 a second etc.
Right now I’m just filling it up every Update(), by increasing it’s value by 1, but I’m not sure how to tie all of it together with using actual time.
Here’s my code so far
void UpdateMachines()
{
for (int i = 0; i<productsArray.Count; i++) {
ProductData product = productsArray*;*
-
if(product.makeStuff == true)*
-
{*
-
ProductTemplateData productTemplate = product.data;*
-
//product.currentTime --;*
-
//if(product.currentTime <0)*
-
//{*
-
Debug.Log (product.amount);*
-
product.currentTime = productTemplate.constructionTime;*
-
product.barAmount ++;*
-
if(product.barAmount >= 100)*
-
{*
-
product.barAmount = 0;*
_ IncreaseMoney(product.amount*productTemplate.costToSell);_
-
if(product.autoMakeStuff == false)*
-
{*
-
product.makeStuff = false;*
-
}*
-
}*
-
UpdateProductConstructionTime(product.bar, product.barAmount);*
-
//}*
-
}*
-
}*
-
}*