We then want to make sure the enemy can attack the player so what we do is make a new script named EnemyAttack and drag it onto the enemy named Cubebot as well as making sure the player can harm the enemies or Cubebots to do this create another script named Enemyhealth and drag it onto the enemy or Cubebot to apply the script.

Then to make sure that the gun fires in a line I attached a 3D cube that I scaled down to use as a gun and added a particle system component to the cube gun, I then added another component called line renderer which does as it names suggests renders a line expand the materials tab via the dropdown and click on the circle select via the element 0 and is ideal to use a basic line render material which can be gotten from the asset store or other sources, we then want to expand parameters and set start width and end width to 0.05 then disable the line render check box at the top. 

Now add a new component by going into rendering and selecting light this is to give the flash effect when firing the gun. For this you can use the colour picker to set whatever colour you want but for this used a basic yellow orange colour for my gun even if it is a cube and again disable the light check box at the top.

Now to create the PlayerShooting script and drag it onto the gun.

Comments

Popular posts from this blog