ScriptedEntityTweenerModule.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include <IGem.h>
  8. #include <ScriptedEntityTweener/ScriptedEntityTweenerBus.h>
  9. #include "ScriptedEntityTweenerSystemComponent.h"
  10. namespace ScriptedEntityTweener
  11. {
  12. class ScriptedEntityTweenerModule
  13. : public CryHooksModule
  14. {
  15. public:
  16. AZ_RTTI(ScriptedEntityTweenerModule, "{A6A93611-5E4D-4EB5-BFB9-00031F73F59B}", CryHooksModule);
  17. ScriptedEntityTweenerModule()
  18. : CryHooksModule()
  19. {
  20. // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  21. m_descriptors.insert(m_descriptors.end(), {
  22. ScriptedEntityTweenerSystemComponent::CreateDescriptor(),
  23. });
  24. }
  25. /**
  26. * Add required SystemComponents to the SystemEntity.
  27. */
  28. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  29. {
  30. return AZ::ComponentTypeList{
  31. azrtti_typeid<ScriptedEntityTweenerSystemComponent>(),
  32. };
  33. }
  34. void OnSystemEvent(ESystemEvent systemEvent, UINT_PTR wparam, UINT_PTR lparam)
  35. {
  36. CryHooksModule::OnSystemEvent(systemEvent, wparam, lparam);
  37. switch (systemEvent)
  38. {
  39. // In editor mode, ensure ending editor mode clears any in-flight animations
  40. case ESYSTEM_EVENT_GAME_MODE_SWITCH_END:
  41. {
  42. bool inGame = wparam == 1;
  43. if (!inGame)
  44. {
  45. EBUS_EVENT(ScriptedEntityTweenerBus, Reset);
  46. }
  47. } break;
  48. default:
  49. break;
  50. }
  51. }
  52. };
  53. }
  54. // DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM
  55. // The first parameter should be GemName_GemIdLower
  56. // The second should be the fully qualified name of the class above
  57. AZ_DECLARE_MODULE_CLASS(Gem_ScriptedEntityTweener, ScriptedEntityTweener::ScriptedEntityTweenerModule)