Implementing a Bullet class
Next, we set up our Bullet prefab with two orthogonal planes and a box collider, using a laser-like material and a Particles/Additive-Layer property in the Shader field:
Figure 2.4 – Our Bullet prefab
The code in the Bullet.cs file is as follows:
using UnityEngine;
using System.Collections;
public class Bullet : MonoBehaviour {
//Explosion Effect
[SerializeField] // Used to expose in the inspector private
// fields!
private GameObject Explosion;
[SerializeField]
private float Speed = 600.0f;
[SerializeField]
private float LifeTime = 3.0f;
public int damage = 50;
void Start() {
...