© 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_33

33. Enemy Logic

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

Pathfinding is happening automatically to generate our GroundEnemy path around towers, we have arrow towers, and we have our base Enemy script class to build our GroundEnemy and FlyingEnemy scripts off of. Let’s get to making our Play Button initiate the spawning of enemies, then implement our two enemy types. We’ll have our GroundEnemy following the path generated by the pathfinding, while our FlyingEnemy simply navigates from the spawn point to the leak point.

Play Mode Setup

The Play button will start the level ...

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.