- Home /
Accurate Text
private void OnTriggerStay2D(Collider2D collision)
{
if (collision.tag == "Player" && cargoBar.fillAmount < 1 && cPScript.ore > 0)
{
oreCollected += collectSpeed * Time.deltaTime;
cPScript.ore -= collectSpeed * Time.deltaTime;
cargoBar.fillAmount += collectSpeed / maxCargo * Time.deltaTime;
}
}
I'm making a game where you mine planets to gain points but whenever you are at capacity the planet ore count is a little of (like instead of 400 its 398 or 399) I anyone could help that would be apricated
Comment
Time.delaTime is the duration in seconds of the execution of the last frame. It is unlikely to be a nice round number. Why are you using it to calculate collections? I would think that so long as you use it to moderate the speed of your player, then you wouldn't need it to moderate the value of the collections?