Creating triple shot prefab in Unity
Currently in the project there is a player able to shoot a single laser, in this challenge I am gonna create a triple shot laser to be used later as a powerup.
First I created an empty object called Triple_Shot and set the transform position to 0.
Then within the Triple_Shot object I have to add 3 laser prefabs and positioning according to the player sprite. After that we have to drop the Triple_Shot Object in the prefabs folder.
In the player script I’m going to add a _tripleShot variable to assign the prefab in the inspector and create another bool variable called _isTripleShotActive.
In the Shot function we are going to check the variable isTripleShotActive value to instantiate the triple shot prefab.
And that is it, in play mode if we switch the value of the bool variable the player shoots a triple shot instead of a single laser.