O'Reilly logo

Mastering Unity 2017 Game Development with C# - Second Edition by Alan Thorn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Comments

  • The StateAttack coroutine begins and remains throughout the Attack state.
  • The Transform.LookAt function is called during the coroutine loop, on each frame, to reorient the enemy to always face the player character.
  • If the enemy falls outside the Attack distance, he reverts to the Chase state to catch up with the player. The distance between player and enemy is determined by the Vector3.Distance function.
  • If the zombie reaches StoppingDistance from the player, they stop moving and continue to attack.

The Attack state, as it stands, is not sufficient to actually inflict damage on the player. The StateAttack coroutine, for example, contains no code to interact with the player character and therefore causes no damage for each punch ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required