void Update() { if (timer > 0) { timer -= Time.deltaTime; isExploded = false; } if (isHeld) { //transform.position = currentPlayer.transform.position; if (timer <= 0) { // BOOM!!! isExploded = true; sfx.PlayExplodeAudio(); } } else { flightTime += Time.deltaTime; if (onReturnFlight) { // Add force towards the player Vector3 vecBetween = (currentPlayer.transform.position - transform.position); Vector3 dirToPlayer = vecBetween.normalized; rb.AddForce(dirToPlayer * flightTime * flightTime, ForceMode.Impulse); } else { if (flightTime > 0.5f && rb.velocity.magnitude < minVelocityToReturn) { StartReturn(); flightTime = 0; } } } }