First pass for network hierarchy input processing

Signed-off-by: pereslav <pereslav@amazon.com>
This commit is contained in:
pereslav
2021-10-01 00:07:23 +01:00
parent bee4346df8
commit ef3552df69
5 changed files with 199 additions and 1 deletions
@@ -188,4 +188,53 @@ 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();
}
}