Network Input Exposed to Script (#3990)

* NetworkInput now has new attribute called ExposeToScript. NetworkInput with this attribute set to True will be exposed to behavior context. Also added a CreateFromValues for the NetworkInput where scripters can create an instance of the MyComponentNetworkInput class which will eventually be passed around CreateInput and ProcessInput events.

Signed-off-by: Gene Walters <genewalt@amazon.com>

* Adding Create Input event handler. SC can now receive the event to create input, and send it over the network

Signed-off-by: Gene Walters <genewalt@amazon.com>

* Auto-component controller will now generate CreateInput/ProcessInput methods if they have input exposed to script, not ready for use yet, just stubbed in

Signed-off-by: Gene Walters <genewalt@amazon.com>

* Reducing code replication by putting common network input variables into AutoComponent_Common.jinja

Signed-off-by: Gene Walters <genewalt@amazon.com>

* Fix minor comment typo in the CreateInput method

Signed-off-by: Gene Walters <genewalt@amazon.com>

* Small fix. Changing ebus call from MyComponentNameCreateInput to just CreateInput. It's part of the MyComponentRequestBus so adding the component name before CreateInput is noisy

Signed-off-by: Gene Walters <genewalt@amazon.com>

* Cleaning with jinja a bit using macro calls to iterate over scriptable netinputs

Signed-off-by: Gene Walters <genewalt@amazon.com>

* ProcessInput will now be triggered in script

Signed-off-by: Gene Walters <genewalt@amazon.com>

* ProcessInput event is sent to script. Script can now create and process input. Tested locally with a simple script.

Signed-off-by: Gene Walters <genewalt@amazon.com>

* Created a seperate CreateInputFromScript and ProcessInputFromScript. Developers no longer need to remember to call the BaseClass::CreateInput and ProcessInput since CreateInputFromScript will automatically be called beforehand.

Signed-off-by: Gene Walters <genewalt@amazon.com>
This commit is contained in:
Gene Walters
2021-09-14 12:01:32 -07:00
committed by GitHub
parent a91ea7d549
commit 73b04d7e34
5 changed files with 204 additions and 8 deletions
@@ -278,6 +278,7 @@ namespace Multiplayer
AZ_Assert(IsNetEntityRoleAutonomous(), "Incorrect network role for input creation");
for (MultiplayerComponent* multiplayerComponent : m_multiplayerInputComponentVector)
{
multiplayerComponent->GetController()->CreateInputFromScript(networkInput, deltaTime);
multiplayerComponent->GetController()->CreateInput(networkInput, deltaTime);
}
}
@@ -289,6 +290,7 @@ namespace Multiplayer
AZ_Assert((NetworkRoleHasController(m_netEntityRole)), "Incorrect network role for input processing");
for (MultiplayerComponent* multiplayerComponent : m_multiplayerInputComponentVector)
{
multiplayerComponent->GetController()->ProcessInputFromScript(networkInput, deltaTime);
multiplayerComponent->GetController()->ProcessInput(networkInput, deltaTime);
}
m_isProcessingInput = false;