The next thing we will do is give our player the ability to shoot:
PlayerBehaviourscript. In the top section where the other variables are present, we need to add some additional ones that we'll use:
// The laser we will be shooting public Transform laser; // How far from the center of the ship should the laser be public float laserDistance = .2f; // How much time (in seconds) we should wait before // we can fire again public float timeBetweenFires = .3f; // If value is less than or equal 0, we can fire private float timeTilNextFire = 0.0f; // The buttons that we can use to shoot lasers public List<KeyCode> shootButton;
One thing you may have noticed is that we have a
laser variable that is of the type
Transform. This ...