Book Image

Unity Game Development Blueprints

By : John P. Doran
Book Image

Unity Game Development Blueprints

By: John P. Doran

Overview of this book

Table of Contents (16 chapters)
Unity Game Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the shooting behavior


Now, with a traditional first person shooter, we shoot a bullet from a gun to damage enemies. However, we will create a camera that will shoot pictures to damage enemies. To show how easy it is to do, let's get started! Perform the following steps:

  1. The first thing we need to do is go to the FlashlightController object we created earlier. So, with it selected, double-click on it to center the camera on it.

  2. Our camera weapon is going to be another object, which will be a child of the Main Camera object. To do this, first select the Main Camera object that is located on our FlashlightController object and then navigate to GameObject | Create Empty Child. Also, in the Inspector section for this newly created object, confirm whether the object's position is 0, 0, 0. If it isn't, set it. Finally, name the object Photo Camera. Have a look at the following screenshot:

  3. Next, add a camera component by clicking on the Add Component button at the bottom of the Inspector tab...