Updating service requirement to use a generic 'MultiplayerInputDrive', that way if other developers want to make a non-local predictition player controller that calls create/process on the server they can do so as long as there custom component provides this 'MultiplayerInputDriver' service

Signed-off-by: Gene Walters <genewalt@amazon.com>
This commit is contained in:
Gene Walters
2021-08-16 20:46:34 -07:00
parent e475405850
commit 4374e6177e
3 changed files with 10 additions and 3 deletions
@@ -22,6 +22,7 @@ namespace Multiplayer
AZ_MULTIPLAYER_COMPONENT(Multiplayer::LocalPredictionPlayerInputComponent, s_localPredictionPlayerInputComponentConcreteUuid, Multiplayer::LocalPredictionPlayerInputComponentBase);
static void Reflect([[maybe_unused]] AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
void OnInit() override;
void OnActivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating) override;
@@ -1465,10 +1465,10 @@ namespace {{ Component.attrib['Namespace'] }}
{% call(ComponentService) ParseComponentServiceNames(Component, ClassType, 'Required') %}
required.push_back(AZ_CRC_CE("{{ ComponentService }}"));
{% endcall %}
{% if NetworkInputCount > 0 %}
// This component uses NetworkInputs so it requires LocalPredictionPlayerInputComponent which is responsible for calling CreateInput and ProcessInput
required.push_back(AZ_CRC_CE("LocalPredictionPlayerInputComponent"));
// This component uses NetworkInputs so it requires a MultiplayerInputDriver service which is responsible for calling CreateInput and ProcessInput
required.push_back(AZ_CRC_CE("MultiplayerInputDriver"));
{% endif %}
}
@@ -56,6 +56,12 @@ namespace Multiplayer
LocalPredictionPlayerInputComponentBase::Reflect(context);
}
void LocalPredictionPlayerInputComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
LocalPredictionPlayerInputComponentBase::GetProvidedServices(provided);
provided.push_back(AZ_CRC_CE("MultiplayerInputDriver"));
}
void LocalPredictionPlayerInputComponent::OnInit()
{
;