protected override void OnStartLosingPlayer() { base.OnStartLosingPlayer(); StartCoroutine(LookingForPlayer()); NavMeshAgent.GoToShortestWaypointLocation(Waypoints, ref CurrentWaypointIndex); //navMeshAgent.destination = navMeshAgent.getsho(transform, waypoints, ref currentWaypointIndex); GoingBackToWaypoint = true; }
protected virtual void ResumePatrolling() { Debug.Log("resume"); NavMeshAgent.speed = WalkSpeed; NavMeshAgent.stoppingDistance = 0; LostInterestToDistractor = 0; IsLookingForPlayer = false; Status = GuardStatus.Patrolling; GoingBackToWaypoint = true; NavMeshAgent.GoToShortestWaypointLocation(Waypoints, ref CurrentWaypointIndex); }
IEnumerator CrtEatCorn() { while (_corn.Health > 0 || _corn != null) { _corn.Health -= EatSubstraction; yield return(new WaitForSecondsRealtime(EatingSpeed)); } _corn = null; IsEatingCorn = false; IsPecking = false; NavMeshAgent.GoToShortestWaypointLocation(Waypoints, ref CurrentWaypointIndex); ChickenState = ChickenState.Moving; Animator.SetFloat("speed", 1); Animator.SetBool("pecking", false); NavMeshAgent.stoppingDistance = 0; //avmeshUpdateRate = .1f; }