private void TargetResource() { if (target != null) { target.IncreaseResourceAmount(nextHarvest); } target = findResource(); if (target != null) { if (state == State.Idle && ant.GetAgent().isOnNavMesh) { ant.GetAgent().isStopped = false; } ant.StopCoroutine(Scout()); ant.StopCoroutine(ReturnToBase()); scouting = false; nextHarvest = target.DecreaseFutureResources(carryWeight - carryingObjects.Count); ant.GetAgent().SetDestination(target.GetPosition()); state = State.MovingToResource; busy = true; } else if (state == State.Idle && IsScout) { if (ant.GetAgent().isOnNavMesh) { ant.GetAgent().isStopped = false; } ant.StartCoroutine(ExitBase(State.Scouting)); } else if (!ant.AtBase()) { ant.StartCoroutine(EnterBase(ant.GetBaseController().GetPosition())); state = State.MovingToStorage; } }