EnergyCannonComponent.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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_BallLaunched(AzNetworking::IConnection* invokingConnection) override;
  21. #endif
  22. private:
  23. GameEffect m_effect;
  24. };
  25. class EnergyCannonComponentController
  26. : public EnergyCannonComponentControllerBase
  27. {
  28. public:
  29. explicit EnergyCannonComponentController(EnergyCannonComponent& parent);
  30. void OnActivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  31. void OnDeactivate(Multiplayer::EntityIsMigrating entityIsMigrating) override;
  32. #if AZ_TRAIT_SERVER
  33. private:
  34. void OnFireEnergyBall();
  35. AZ::ScheduledEvent m_firingEvent{[this]()
  36. {
  37. OnFireEnergyBall();
  38. }, AZ::Name("FireEnergyCannon")};
  39. void OnKillEnergyBall();
  40. AZ::ScheduledEvent m_killEvent{ [this]()
  41. {
  42. OnKillEnergyBall();
  43. }, AZ::Name("KillEnergyBall") };
  44. #endif
  45. };
  46. }