float damage = 0.0f;
float maxDamage = 100.0f;
float speed = 2.0f;
float t = 0.0f;
void Update()
{
if (Input.GetMouseButton(0))
{
t += Time.deltaTime * speed;
damage = Mathf.PingPong(t, maxDamage);
}
if (Input.GetMouseButtonUp(0))
{
t = 0.0f;
print($"piu piu {damage}");
}
}