Enabled multi-entities player prefabs. Added updating replication set for hierarchy children. PR feedback addressing

Signed-off-by: pereslav <pereslav@amazon.com>
This commit is contained in:
pereslav
2021-10-07 00:38:07 +01:00
parent 801e54c599
commit a58325e691
10 changed files with 69 additions and 134 deletions
@@ -188,53 +188,4 @@ namespace Multiplayer
}
m_wasAttached = rhs.m_wasAttached;
}
NetworkSubInput::NetworkSubInput(const ConstNetworkEntityHandle& entityHandle)
: m_owner(entityHandle)
{
Attach(m_owner);
}
void NetworkSubInput::Attach(const ConstNetworkEntityHandle& entityHandle)
{
m_owner = entityHandle;
if (auto* localEnt = entityHandle.GetEntity())
{
NetBindComponent* netBindComponent = localEnt->FindComponent<NetBindComponent>();
if (netBindComponent)
{
m_networkInput.AttachNetBindComponent(netBindComponent);
}
}
}
const ConstNetworkEntityHandle& NetworkSubInput::GetOwner() const
{
return m_owner;
}
NetworkInput& NetworkSubInput::GetNetworkInput()
{
return m_networkInput;
}
const NetworkInput& NetworkSubInput::GetNetworkInput() const
{
return m_networkInput;
}
bool NetworkSubInput::Serialize(AzNetworking::ISerializer& serializer)
{
NetEntityId tmpId = m_owner.GetNetEntityId();
serializer.Serialize(tmpId, "OwnerId");
if (serializer.GetSerializerMode() == AzNetworking::SerializerMode::WriteToObject)
{
m_owner = AZ::Interface<INetworkEntityManager>::Get()->GetEntity(tmpId);
}
serializer.Serialize(m_networkInput, "NetInput");
return serializer.IsValid();
}
}
@@ -12,10 +12,7 @@
namespace Multiplayer
{
//! Max number of entities that can be children of our netbound player entity.
static constexpr uint32_t MaxEntityHierarchyChildren = 16;
//! Used by the EntityHierarchyComponent. This component allows the gameplay programmer to specify inputs for dependent entities.
//! Used by the NetworkHierarchyRootComponent. This component allows the gameplay programmer to specify inputs for dependent entities.
//! Since it is possible to for the Client/Server to disagree about the state of related entities,
//! this network input encodes the entity that is associated with it.
class NetworkInputChild