void CrowdAgent::OnSetEnabled() { bool enabled = IsEnabledEffective(); if (enabled && !inCrowd_) AddAgentToCrowd(); else if (!enabled && inCrowd_) RemoveAgentFromCrowd(); }
void CrowdAgent::SetMoveTarget(const Vector3& position) { if (crowdManager_) { if (!inCrowd_) AddAgentToCrowd(); targetPosition_ = position; if (crowdManager_->SetAgentTarget(this, position, targetRef_)) MarkNetworkUpdate(); } }
void CrowdAgent::OnSceneSet(Scene* scene) { if (scene) { if (scene == node_) LOGERROR(GetTypeName() + " should not be created to the root scene node"); crowdManager_ = scene->GetOrCreateComponent<DetourCrowdManager>(); AddAgentToCrowd(); } else RemoveAgentFromCrowd(); }
bool CrowdAgent::SetMoveTarget(const Vector3& position) { if (crowdManager_ && !inCrowd_) AddAgentToCrowd(); if (crowdManager_ && inCrowd_) { targetPosition_ = position; if (crowdManager_->SetAgentTarget(this, position, targetRef_)) { MarkNetworkUpdate(); return true; } } return false; }
void CrowdAgent::OnNodeSet(Node* node) { if (node) { Scene* scene = GetScene(); if (scene) { if (scene == node) LOGERROR(GetTypeName() + " should not be created to the root scene node"); crowdManager_ = scene->GetOrCreateComponent<DetourCrowdManager>(); AddAgentToCrowd(); } node->AddListener(this); } }