I set up a new shooting mechanic using this code.
public float damage = 1;
[Range(0, 100)]
public int criticalHitChance = 20;
public float criticalHitMultiplier = 2;
void Update() {
RaycastHit hit;
if(Input.GetButtonDown ("Fire1") && Input.GetAxis ("Fire1")){
float deal = damage;
if(criticalHitChance > 0 && Random.value <= criticalHitChance / 100f)
deal *= criticalHitMultiplier;
if(hit.collider.CompareTag("Enemy"))
hit.collider.SendMessage("Damage", new HealthEvent(gameObject, deal), SendMessageOptions.DontRequireReceiver);
}
}
I want the mouse and controller to access the code
My question is, how can I setup the shooting code as both bool and float?