ROS2EditorClockSystemComponent.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "ROS2EditorClockSystemComponent.h"
  9. #include <AzCore/Serialization/SerializeContext.h>
  10. #include <ROS2/ROS2TypeIds.h>
  11. namespace ROS2
  12. {
  13. AZ_COMPONENT_IMPL(ROS2EditorClockSystemComponent, "ROS2EditorClockSystemComponent", ROS2EditorClockSystemComponentTypeId, BaseSystemComponent);
  14. void ROS2EditorClockSystemComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  17. {
  18. serializeContext->Class<ROS2EditorClockSystemComponent, BaseSystemComponent>()->Version(0);
  19. }
  20. }
  21. void ROS2EditorClockSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  22. {
  23. BaseSystemComponent::GetProvidedServices(provided);
  24. provided.push_back(AZ_CRC_CE("ROS2EditorClockService"));
  25. }
  26. void ROS2EditorClockSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  27. {
  28. BaseSystemComponent::GetIncompatibleServices(incompatible);
  29. incompatible.push_back(AZ_CRC_CE("ROS2EditorClockService"));
  30. }
  31. void ROS2EditorClockSystemComponent::Activate()
  32. {
  33. AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
  34. AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
  35. }
  36. void ROS2EditorClockSystemComponent::Deactivate()
  37. {
  38. AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
  39. AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
  40. }
  41. void ROS2EditorClockSystemComponent::OnStartPlayInEditorBegin()
  42. {
  43. BaseSystemComponent::Activate();
  44. }
  45. void ROS2EditorClockSystemComponent::OnStopPlayInEditor()
  46. {
  47. BaseSystemComponent::Deactivate();
  48. }
  49. } // namespace ROS2