Introduction to Tower Defense Template

Vérifié avec version: 2017.2


Difficulté: Intermédiaire

About the Tower Defense Template

Unity’s Tower Defense Template provides a simple but polished example of a tower defense game. This template serves two purposes: it teaches us best practices using a professional, real-world example and it provides us with a solid base on which we can build a more complex tower defense game of our own for both desktop and mobile platforms.

To understand this template and make our own game, we will need to understand how to work with the three most important parts of the template: towers, enemy agents, and game levels in which those enemies and towers can interact with each other.

The Tower Defense game

Tower defense games understand a tower as an object, fixed in place, that is used to shoot at enemies to stop them from reaching an objective point. Towers can also perform non-attack effects, like slowing enemies down, or generating more currency for a player to buy even more towers. The player will often have the option to upgrade towers to higher levels to make them more powerful or have a longer range. It is not necessary that these objects take the form of towers or turrets in the game. The "tower" part of “tower defense” is more of a historical convention than a rigid genre definition.

The Action Game Framework and the Core Framework

The Tower defense Template is made using two reusable frameworks.

The first framework is called the Action Game Framework. The Action Game Framework includes code that covers concepts needed in action games, such as taking damage and logic for ballistics and projectiles.

The second framework is called the Core Framework. The Core Framework covers concepts that are common to games of all genres, such as game saving, data management, timers, math utilities and more.

Important concepts in these frameworks will be explained in this document. For a thorough overview of the Action Game Framework, please see the Action Game Framework Reference