Adding force the longer you hold a button, instead of clicking it?

I’m creating an arcade tank game and when you shoot you simply press and hold the space bar (on PCs/Macs, that is) to apply force; the longer you hold the space bar the more force, etc. I am wanting to port my game over to mobile devices and use a button. How can I set it up to the longer I hold a button, the more force it applies and to shoot when I let go of the button or it reaches max force? Also here is my code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using Shell;
using UnityEngine.EventSystems;

public class PlayerAttack : MonoBehaviour
{
public Rigidbody Shell;
public Transform FireTransform;
public Slider AimSlider;
public float MinForce = 15f;
public float MaxForce = 30f;
//publicfloatMaxForce=TankLevel.CurrentLevel*6f;
public float MaxCharge = 0.75f;
public bool Fired;
public Button BFire;

string FireButton;
float CurrentForce;
float ChargeSpeed;

void OnEnable ()
{
CurrentForce = MinForce;
AimSlider.value = MinForce;
}

void Start ()
{
FireButton = "Fire";

ChargeSpeed = (MaxForce - MinForce) / MaxCharge;
}

void Update ()
{
AimSlider.value = MinForce;

if (CurrentForce >= MaxForce && !Fired)
{
CurrentForce = MaxForce;
Fire ();
}
else if (Input.GetButtonDown (FireButton))
{
Fired = false;
CurrentForce = MinForce;
}
else if (Input.GetButton (FireButton) && !Fired)
{
CurrentForce += ChargeSpeed * Time.deltaTime;

AimSlider.value = CurrentForce;
}
else if (Input.GetButtonUp (FireButton) && !Fired)
{
Fire ();
}
}

public void Fire ()
{
Fired = true;

Rigidbody shellInstance = Instantiate (Shell, FireTransform.position, FireTransform.rotation) as Rigidbody;

shellInstance.velocity = CurrentForce * FireTransform.forward;

CurrentForce = MinForce;
}
}

Bumping.

Grab Input.GetButtonDown (or GetKeyDown, or whatevs), record that start time, then on Input.GetButtonUp calculate the difference in time and base the amount of force on that change in time.

If you want to fill a visual bar, during GetButton, calculate the current change in time, and fill the bar accordingly.

During GetButton, if you reach max, fire anyway.

[edit]
noticed you posted code, you pretty much have it… is there something specific with your code that’s not working?

That works for computers. when I use the OnClick function for the button (and I probably shouldn’t now that I look at it) I assign it to Fire(); since I’m not sure what else to assign it to and it doesn’t let me hold and apply more force.