Question by
salmanali228 · Nov 19, 2015 at 07:39 AM ·
shootingprojectilefire
how I can control projectile shooting limit???
using UnityEngine;
using System.Collections;
public class GunProjectile : MonoBehaviour {
public float speed = 20f;
public Rigidbody projectile;
void Update() {
if (Input.GetButtonDown("Fire1")) {
Rigidbody clone;
clone = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody;
clone.velocity = transform.TransformDirection(Vector3.forward * speed);
}
}
}
Comment
Not enough info. What do you mean shooting limit?
Rate of fire?
$$anonymous$$ax ammo?
$$anonymous$$ax concurrent objects?