void VillagerCollect() { if (targetObject == null) { isWorking = false; agent.enabled = true; currentState = CHARACTER_STATE.CHARACTER_WANDER; } if (isWorking && targetObject != null) { timer += Time.deltaTime; if (timer >= workTimer) { switch (workingResource.GetResourceType()) { case 0: workingResource.MineResource((int)taskSkills.mining * 10); break; case 1: workingResource.MineResource((int)taskSkills.woodcutting * 10); break; case 2: workingResource.MineResource((int)taskSkills.farming * 10); break; } timer = 0; } } else if (!isWorking && targetObject != null) { isWorking = true; agent.enabled = false; workTimer = wanderTimer; } }