Game Development Reference
In-Depth Information
Illustration 90: Player game object configured completely
With this confi tion of player's game object, the input system of our shooting mechanism
is complete. We have now to deal with the output. Both rifl and sniper weapons can be im-
plemented using ray casting. Therefore, it is reasonable to reuse our RaycastShooter script in
Listing 49 (page 128). All we have to do is to add RaycastShooter to the game objects of
rifl and sniper, set its properties (range, inaccuracy, power), and make a “bridge” script that
receives OnWeaponFire message from GeneralWeapon and eventually call Shoot() function
of RaycastShooter . Th s is a very simple script called WeaponToRaycast , shown in Listing 85.
Search WWH ::




Custom Search