© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
C. HardmanGame Programming with Unity and C#https://doi.org/10.1007/978-1-4842-9720-9_28

28. Enemies and Projectiles

Casey Hardman1  
(1)
West Palm Beach, FL, USA
 

In this chapter, we’ll set up the basis for both our enemies and the projectiles our towers will fire. We’ll be getting into some inheritance to do this. Since we’ll have ground enemies that move around our towers as well as flying enemies that go right over them in a straight line, we need to make sure we have a base class for our enemies that provides the common functionality that both enemy types will need – notably, taking damage and dying.

Similarly, our projectiles will come in two different ...

Get Game Programming with Unity and C#: A Complete Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.