NetworkTeleportCompatibleComponent.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of
  3. * this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <Source/AutoGen/NetworkTeleportCompatibleComponent.AutoComponent.h>
  10. #include <Source/Effects/GameEffect.h>
  11. namespace MultiplayerSample
  12. {
  13. class NetworkTeleportCompatibleComponent
  14. : public NetworkTeleportCompatibleComponentBase
  15. {
  16. public:
  17. AZ_MULTIPLAYER_COMPONENT(
  18. MultiplayerSample::NetworkTeleportCompatibleComponent, s_networkTeleportCompatibleComponentConcreteUuid, MultiplayerSample::NetworkTeleportCompatibleComponentBase);
  19. static void Reflect(AZ::ReflectContext* context);
  20. void OnInit() override {}
  21. void OnActivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating) override;
  22. void OnDeactivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating) override;
  23. #if AZ_TRAIT_CLIENT
  24. void HandleNotifyTeleport(AzNetworking::IConnection* invokingConnection, const AZ::Vector3& teleportedLocation) override;
  25. #endif
  26. private:
  27. GameEffect m_effect;
  28. };
  29. class NetworkTeleportCompatibleComponentController
  30. : public NetworkTeleportCompatibleComponentControllerBase
  31. {
  32. public:
  33. NetworkTeleportCompatibleComponentController(NetworkTeleportCompatibleComponent& parent);
  34. void OnActivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating) override {};
  35. void OnDeactivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating) override {};
  36. #if AZ_TRAIT_SERVER
  37. void HandleTeleport(
  38. AzNetworking::IConnection* invokingConnection, const AZ::Vector3& teleportedLocation) override;
  39. #endif
  40. };
  41. } // namespace MultiplayerSample