Class ShootScript
Basic shooting script
Inheritance
System.Object
ShootScript
Namespace: Assets.Src
Assembly: cs.temp.dll.dll
Syntax
public class ShootScript : MonoBehaviour
Fields
BulletPrefab
Prefab instantiated when shooting
Declaration
public GameObject BulletPrefab
Field Value
| Type | Description |
|---|---|
| GameObject |
BulletSpawn
Bullet spawn point. Bullet will be shot in local forward direction
Declaration
public Transform BulletSpawn
Field Value
| Type | Description |
|---|---|
| Transform |
FireRate
Firerate in shots per second. Must not be 0!
Declaration
public double FireRate
Field Value
| Type | Description |
|---|---|
| System.Double |
Examples
void OnCollisionEnter(Collider other) {
//half fire rate when hit.
gameObject.GetComponent<ShootScript>().FireRate /= 2;
}
Methods
Update()
Update method called once per frame
Declaration
public void Update()