Book Image

Mastering Unity Scripting

By : Alan Thorn
Book Image

Mastering Unity Scripting

By: Alan Thorn

Overview of this book

Table of Contents (17 chapters)
Mastering Unity Scripting
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 7. Artificial Intelligence

This chapter takes a highly practical and specialized focus. Here, we'll cover the development of a single Unity project from start to finish in creating a maze scene that features enemy characters with Artificial Intelligence (AI); these characters have the ability to search for and chase us, attack us, and also flee from us while looking for health-restore potions. The following screenshot shows the maze scene in Unity:

The maze scene

Tip

The AI project for this book can be found in the book's companion files (code bundle) in the ai folder of this chapter.

In creating this project, we'll apply nearly all the concepts and ideas seen so far in an isolated and pure form, looking at how they come together in the project, alongside a unique range of AI concepts, such as Finite State Machines (FSMs), navigation meshes, line of sight, and more. To follow this chapter and get the most from it, I recommend that you create a new and blank Unity project and take each...