In the first demo, we will build an enemy ship that senses for the player, and if it sees the player, it starts moving toward it and then attacks it. A simple version of this would be to have the enemy wander with a visual sensor to detect the player, and if it sees the player, the enemy will move toward it and attack it. This would work but it really wouldn't be any different from the demo from Chapter 7, Adaptation, where the ship had to search for and collect gold. To make it a little different, we'll use a two-sensor approach. We will have one larger sensor on the enemy that detects the player, and if the enemy senses the player aspect, it will start chasing the player. Then, there is a second smaller sensor that attacks the player, that is, if it senses the player, then the enemy stops chasing and it instead attacks. This gives the effect of chasing the player but when the enemy gets closer, it stops and starts attacking, instead of just chasing and attacking...
Unity AI Programming Essentials
By :
Unity AI Programming Essentials
By:
Overview of this book
Table of Contents (19 chapters)
Unity AI Programming Essentials
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Pathfinding
Patrolling
Behavior Trees
Crowd Chaos
Crowd Control
Sensors and Activities
Adaptation
Attacking
Driving
Animation and AI
Advanced NavMesh Generation
Index
Customer Reviews