void UpdateControl() { if (m_ControlledBy == ControllerType.Random) { if (m_NavigateTo == default) { var dirt = GameObject.FindWithTag("Dirt"); if (dirt != null) { m_Target = dirt; if (IsTargetReachable()) { StartCoroutine(Collect(dirt)); } else { m_NavigateTo = StartCoroutine(NavigateTo(dirt)); } } } } else { m_Controller.AutoUpdate = true; if (m_Controller.IsIdle && Time.realtimeSinceStartup > m_TimeOfLastWorldQuery + m_SensorDelay) { m_Controller.UpdateStateWithWorldQuery(); m_TimeOfLastWorldQuery = Time.realtimeSinceStartup; } } }
void UpdateControl() { if (m_ControlledBy == ControllerType.Random) { if (m_NavigateTo == default) { var dirt = GameObject.FindWithTag("Dirt"); if (dirt != null) { m_Target = dirt; if (IsTargetReachable()) { StartCoroutine(Collect(dirt)); } else { m_NavigateTo = StartCoroutine(NavigateTo(dirt)); } } } } else { m_Controller.AutoUpdate = true; if (m_UpdateStateWithWorldQuery && m_Controller.PlanExecutionStatus != PlanExecutionStatus.ExecutingAction) { m_Controller.UpdateStateWithWorldQuery(); m_UpdateStateWithWorldQuery = false; } } }