public override void UpdateState(SmartMan EnimeAI) //OverRidded From BaseAI { Debug.Log("Move"); if (Vector3.Distance(EnimeAI.transform.position, EnimeAI.Waypoints[current].transform.position) < EnimeAI.WPRadius) // Condition Between Enemy and Waypoints is greater than WayPoint Raduius. { Debug.Log("Move"); if (endReached == false) //Move next Wp { current++; } EnimeAI.StartCoroutine(IdleWhenWayPointReached(EnimeAI)); //IEnumrator Starts For IDLE at waypoint if (current >= EnimeAI.Waypoints.Length) // if CurrentWp is larger equal to Waypoints go back to //EndReached to last WP { current--; endReached = true; } else if (endReached == true) //Condition EndReached is false so the cuurent is firstway Point else go back to Current 0 { if (current == 0) { endReached = false; } else { current--; } } Debug.Log(current); } if (!isIdle) { Debug.Log("IM AI AND IM MOVING"); Move(EnimeAI); // IF not Is Idle Move EnimeAI.anim.SetBool("isWalk", true); //Play Animation } if (Vector3.Distance(EnimeAI.playerTransform.position, EnimeAI.transform.position) < 2f || EnimeAI.Alerted == true) //Condition To Seek Class Position Between Player and Enemy { EnimeAI.CurrentState = new SeekChase(); } }
public AttackBeh(PlayerController player, SmartMan EnimeAI) { IsAttacking = true; EnimeAI.StartCoroutine(Attack(player, EnimeAI)); EnimeAI.anim.SetBool("isRun", false); }