EnergyCannonComponent.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 this distribution.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0 OR MIT
  5. *
  6. */
  7. #pragma once
  8. #include <Source/AutoGen/EnergyCannonComponent.AutoComponent.h>
  9. namespace MultiplayerSample
  10. {
  11. class EnergyCannonComponent
  12. : public EnergyCannonComponentBase
  13. {
  14. public:
  15. AZ_MULTIPLAYER_COMPONENT(MultiplayerSample::EnergyCannonComponent, s_energyCannonComponentConcreteUuid, MultiplayerSample::EnergyCannonComponentBase);
  16. static void Reflect(AZ::ReflectContext* context);
  17. void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  18. void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  19. #if AZ_TRAIT_CLIENT
  20. void HandleRPC_TriggerBuildup(AzNetworking::IConnection* invokingConnection) override;
  21. void HandleRPC_StopBuildup(AzNetworking::IConnection* invokingConnection) override;
  22. #endif
  23. private:
  24. GameEffect m_effect;
  25. };
  26. class EnergyCannonComponentController
  27. : public EnergyCannonComponentControllerBase
  28. {
  29. public:
  30. explicit EnergyCannonComponentController(EnergyCannonComponent& parent);
  31. void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  32. void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  33. #if AZ_TRAIT_SERVER
  34. private:
  35. void OnTriggerBuildup();
  36. AZ::ScheduledEvent m_triggerBuildupEvent{ [this]()
  37. {
  38. OnTriggerBuildup();
  39. }, AZ::Name("BuildupEnergyCannon") };
  40. void OnFireEnergyBall();
  41. AZ::ScheduledEvent m_firingEvent{[this]()
  42. {
  43. OnFireEnergyBall();
  44. }, AZ::Name("FireEnergyCannon")};
  45. #endif
  46. };
  47. }