EnergyCannonComponent.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #endif
  22. // Invoked directly by the energy ball projectile component on the client
  23. void KillBuildupEffect() const;
  24. private:
  25. GameEffect m_effect;
  26. };
  27. class EnergyCannonComponentController
  28. : public EnergyCannonComponentControllerBase
  29. {
  30. public:
  31. explicit EnergyCannonComponentController(EnergyCannonComponent& parent);
  32. void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  33. void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  34. #if AZ_TRAIT_SERVER
  35. private:
  36. void OnTriggerBuildup();
  37. AZ::ScheduledEvent m_triggerBuildupEvent{ [this]()
  38. {
  39. OnTriggerBuildup();
  40. }, AZ::Name("BuildupEnergyCannon") };
  41. void OnFireEnergyBall();
  42. AZ::ScheduledEvent m_firingEvent{[this]()
  43. {
  44. OnFireEnergyBall();
  45. }, AZ::Name("FireEnergyCannon")};
  46. #endif
  47. };
  48. }