Added tests. Made network spawnable to serialize in binary

Signed-off-by: pereslav <pereslav@amazon.com>
This commit is contained in:
pereslav
2021-10-14 23:21:04 +01:00
parent fc72a1a327
commit b1a76feead
8 changed files with 256 additions and 4 deletions
@@ -0,0 +1,61 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <Tests/AutoGen/TestMultiplayerComponent.AutoComponent.h>
namespace MultiplayerTest
{
// Dummy class for satisfying "MultiplayerInputDriver" component dependency
class TestInputDriverComponent : public AZ::Component
{
public:
AZ_COMPONENT(TestInputDriverComponent, "{C3877905-3B61-45AE-A636-9845C3AAA39D}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.emplace_back(AZ_CRC_CE("MultiplayerInputDriver"));
}
void Activate(){};
void Deactivate(){};
};
// Test multiplayer component with ability to create and process network input
class TestMultiplayerComponent
: public TestMultiplayerComponentBase
{
public:
AZ_MULTIPLAYER_COMPONENT(MultiplayerTest::TestMultiplayerComponent, s_testMultiplayerComponentConcreteUuid, MultiplayerTest::TestMultiplayerComponentBase);
static void Reflect(AZ::ReflectContext* context);
void OnInit() override;
void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
AZStd::function<void(Multiplayer::NetEntityId)> m_processInputCallback;
};
// Multiplayer controller for the test component
class TestMultiplayerComponentController
: public TestMultiplayerComponentControllerBase
{
public:
TestMultiplayerComponentController(TestMultiplayerComponent& parent);
//! TestMultiplayerComponentControllerBase
void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
//! MultiplayerController interface
void CreateInput(Multiplayer::NetworkInput& input, float deltaTime) override;
void ProcessInput(Multiplayer::NetworkInput& input, float deltaTime) override;
};
}