public IEnumerator RepairBuilding(BuildingBase building) { while (building.life < building.lifeMax) { building.AddLife(buildSpeed); yield return(new WaitForFixedUpdate()); } }
public IEnumerator MeleeAttack(BuildingBase building) { while (building.life > 0) { if (attackCooldown >= attackCooldownMax) { building.AddLife(-damage); attackCooldown = 0; } else { attackCooldown += attackSpeed; } yield return(new WaitForFixedUpdate()); } }