Skip to Main Content
Unity in Action, Second Edition
book

Unity in Action, Second Edition

by Joseph Hocking
April 2018
Intermediate to advanced content levelIntermediate to advanced
400 pages
11h
English
Manning Publications
Content preview from Unity in Action, Second Edition

3 Adding enemies and projectiles to the 3D game

This chapter covers

  • Taking aim and firing, both for the player and for enemies
  • Detecting and responding to hits
  • Making enemies that wander around
  • Spawning new objects in the scene

The movement demo from the previous chapter was pretty cool, but still not really a game. Let’s turn that movement demo into a first-person shooter. If you think about what else we need now, it boils down to the ability to shoot, and things to shoot at. First, we’re going to write scripts that enable the player to shoot objects in the scene. Then, we’re going to build enemies to populate the scene, including code to both wander around aimlessly and react to being hit. Finally, we’re going to enable the enemies to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Unity Game Optimization - Third Edition

Unity Game Optimization - Third Edition

Dr. Davide Aversa, Chris Dickinson
Unity Game Development Cookbook

Unity Game Development Cookbook

Paris Buttfield-Addison, Jon Manning, Tim Nugent

Publisher Resources

ISBN: 9781617294969Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link