PR feedback addressing
This commit is contained in:
@@ -33,10 +33,10 @@ namespace Multiplayer
|
||||
AzNetworking::IConnection* GetConnection() const override;
|
||||
EntityReplicationManager& GetReplicationManager() override;
|
||||
void Update(AZ::TimeMs serverGameTimeMs) override;
|
||||
bool CanSendUpdates() const override;
|
||||
void SetCanSendUpdates(bool canSendUpdates) override;
|
||||
//! @}
|
||||
|
||||
bool CanSendUpdates();
|
||||
|
||||
private:
|
||||
EntityReplicationManager m_entityReplicationManager;
|
||||
AzNetworking::IConnection* m_connection = nullptr;
|
||||
|
||||
@@ -12,8 +12,13 @@
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
inline bool ClientToServerConnectionData::CanSendUpdates()
|
||||
inline bool ClientToServerConnectionData::CanSendUpdates() const
|
||||
{
|
||||
return m_canSendUpdates;
|
||||
}
|
||||
|
||||
inline void ClientToServerConnectionData::SetCanSendUpdates(bool canSendUpdates)
|
||||
{
|
||||
m_canSendUpdates = canSendUpdates;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,5 +44,13 @@ namespace Multiplayer
|
||||
//! Creates and manages sending updates to the remote endpoint.
|
||||
//! @param serverGameTimeMs current server game time in milliseconds
|
||||
virtual void Update(AZ::TimeMs serverGameTimeMs) = 0;
|
||||
|
||||
//! Returns whether update messages can be sent to the connection.
|
||||
//! @return true if update messages can be sent
|
||||
virtual bool CanSendUpdates() const = 0;
|
||||
|
||||
//! Sets the state of connection whether update messages can be sent or not.
|
||||
//! @param canSendUpdates the state value
|
||||
virtual void SetCanSendUpdates(bool canSendUpdates) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -34,11 +34,10 @@ namespace Multiplayer
|
||||
AzNetworking::IConnection* GetConnection() const override;
|
||||
EntityReplicationManager& GetReplicationManager() override;
|
||||
void Update(AZ::TimeMs serverGameTimeMs) override;
|
||||
bool CanSendUpdates() const override;
|
||||
void SetCanSendUpdates(bool canSendUpdates) override;
|
||||
//! @}
|
||||
|
||||
bool CanSendUpdates() const;
|
||||
void SetCanSendUpdates(bool canSendUpdates);
|
||||
|
||||
NetworkEntityHandle GetPrimaryPlayerEntity();
|
||||
const NetworkEntityHandle& GetPrimaryPlayerEntity() const;
|
||||
|
||||
|
||||
@@ -384,7 +384,7 @@ namespace Multiplayer
|
||||
bool MultiplayerSystemComponent::HandleRequest( AzNetworking::IConnection* connection,
|
||||
[[maybe_unused]] const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::ReadyForEntityUpdates& packet)
|
||||
{
|
||||
auto* connectionData = reinterpret_cast<ServerToClientConnectionData*>(connection->GetUserData());
|
||||
IConnectionData* connectionData = reinterpret_cast<IConnectionData*>(connection->GetUserData());
|
||||
if (connectionData)
|
||||
{
|
||||
connectionData->SetCanSendUpdates(packet.GetReadyForEntityUpdates());
|
||||
|
||||
@@ -462,9 +462,9 @@ namespace Multiplayer
|
||||
|
||||
m_rootSpawnableAsset = netSpawnableAsset;
|
||||
|
||||
auto* iMultiplayer = AZ::Interface<IMultiplayer>::Get();
|
||||
auto* multiplayer = AZ::Interface<IMultiplayer>::Get();
|
||||
|
||||
const auto agentType = iMultiplayer->GetAgentType();
|
||||
const auto agentType = multiplayer->GetAgentType();
|
||||
const bool spawnImmediately =
|
||||
(agentType == MultiplayerAgentType::ClientServer || agentType == MultiplayerAgentType::DedicatedServer);
|
||||
|
||||
@@ -476,7 +476,7 @@ namespace Multiplayer
|
||||
{
|
||||
// If we don't spawn net entities immediately (i.e. it is a client),
|
||||
// tell the server/host it can start sending updates that will instantiate entities.
|
||||
iMultiplayer->SendReadyForEntityUpdates(true);
|
||||
multiplayer->SendReadyForEntityUpdates(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user