Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (Input.GetMouseButtonDown(0))
- {
- isCharging = true;
- currentForce = minForce;
- }
- if (isCharging)
- {
- currentForce += chargeSpeed * Time.deltaTime;
- currentForce = Mathf.Clamp(_currentForce, minForce, maxForce);
- }
- if (Input.GetMouseButtonUp(0))
- {
- isCharging = false;
- if (rb)
- {
- rb.velocity = transform.forward * currentForce;
- }
- currentForce = 0f;
- }
Advertisement
Add Comment
Please, Sign In to add comment