Signed-off-by: AMZN-Olex <5432499+AMZN-Olex@users.noreply.github.com>
This commit is contained in:
AMZN-Olex
2021-09-15 18:49:24 -04:00
parent 2637fa45b8
commit 2be5854beb
2 changed files with 6 additions and 13 deletions
@@ -89,7 +89,7 @@ namespace Multiplayer
if (m_rootEntity)
{
// tell parent to re-build the hierarchy
// Tell parent to re-build the hierarchy
if (NetworkHierarchyRootComponent* root = m_rootEntity->FindComponent<NetworkHierarchyRootComponent>())
{
root->RebuildHierarchy();
@@ -97,8 +97,7 @@ namespace Multiplayer
}
else
{
// notify children to that a hierarchy is disbanded
// Notify children that the hierarchy is disbanding
AZStd::vector<AZ::EntityId> allChildren;
AZ::TransformBus::EventResult(allChildren, GetEntityId(), &AZ::TransformBus::Events::GetChildren);
@@ -127,12 +126,7 @@ namespace Multiplayer
bool NetworkHierarchyRootComponent::IsHierarchicalRoot() const
{
if (GetHierarchyRoot() != InvalidNetEntityId)
{
return false;
}
return true;
return GetHierarchyRoot() == InvalidNetEntityId;
}
bool NetworkHierarchyRootComponent::IsHierarchicalChild() const
@@ -199,7 +193,7 @@ namespace Multiplayer
}
else
{
// detached from parent
// Detached from parent
RebuildHierarchy();
}
}
@@ -217,7 +211,6 @@ namespace Multiplayer
bool hierarchyChanged = false;
// Send out join and leave events.
for (AZ::Entity* currentEntity : m_hierarchicalEntities)
{
const auto prevEntityIterator = AZStd::find(previousEntities.begin(), previousEntities.end(), currentEntity);
@@ -417,14 +417,14 @@ namespace Multiplayer
if (hierarchyChildComponent == nullptr)
{
// child and root hierarchy components are mutually exclusive
// Child and root hierarchy components are mutually exclusive
hierarchyRootComponent = entity->FindComponent<NetworkHierarchyRootComponent>();
}
if ((hierarchyChildComponent && hierarchyChildComponent->IsHierarchicalChild())
|| (hierarchyRootComponent && hierarchyRootComponent->IsHierarchicalChild()))
{
// if hierarchy is enabled for the entity, check if the parent is available
// If hierarchy is enabled for the entity, check if the parent is available
if (const NetworkTransformComponent* networkTransform = entity->FindComponent<NetworkTransformComponent>())
{
const NetEntityId parentId = networkTransform->GetParentEntityId();