Attack and Damage
Enemies should attack the player, and the player should attack the enemies. Both depend on the concept of attacking and taking damage. In this section, we'll use particle systems for inflicting damage, and we'll create script to take damage. First, let's create a player weapon by generating a new particle system. In VR, this object can be made a child of the hand controllers; each hand can have one weapon. In standard first-person mode, the particle system will be a single-fire weapon. To get started for the player attack, create a new particle system in the scene by choosing GameObject | Effects | Particle System. See Figure 10.12:
Once added, we'll need to tweak a lot of settings to make it look like a plasma beam, or a laser cannon. Expand the Shape and Emission settings from the Object Inspector to reveal those particle system properties. See Figure 10.13: