The Attack state is entered when the zombie arrives within the attack distance to the player. During this state, the zombie repeatedly attacks the player until either the player dies or the player leaves the attack distance:
Attack state
Consider the following code:
//------------------------------------
public IEnumerator StateAttack()
{
//Run attack animation
ThisAnimator.SetInteger("AnimState", (int) ActiveState);
//While in idle state
while(ActiveState == AISTATE.ATTACK)
{
//Look at player
Vector3 PlanarPosition = new Vector3(PlayerTransform.position.x, ThisTransform.position.y, PlayerTransform.position.z);
ThisTransform.LookAt(PlanarPosition, ThisTransform.up);
//Get distance between enemy and player
float Distance...