ROSConDemoEditorSystemComponent.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 "ROSConDemoSystemComponent.h"
  9. #include <AzCore/Component/ComponentApplicationBus.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. #include <ROSConDemoEditorSystemComponent.h>
  12. namespace ROSConDemo
  13. {
  14. void ROSConDemoEditorSystemComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  17. {
  18. serializeContext->Class<ROSConDemoEditorSystemComponent, ROSConDemoSystemComponent>()->Version(0);
  19. }
  20. }
  21. ROSConDemoEditorSystemComponent::ROSConDemoEditorSystemComponent() = default;
  22. ROSConDemoEditorSystemComponent::~ROSConDemoEditorSystemComponent() = default;
  23. void ROSConDemoEditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  24. {
  25. ROSConDemoSystemComponent::GetProvidedServices(provided);
  26. provided.push_back(AZ_CRC_CE("ROSConDemoEditorService"));
  27. }
  28. void ROSConDemoEditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  29. {
  30. ROSConDemoSystemComponent::GetIncompatibleServices(incompatible);
  31. incompatible.push_back(AZ_CRC_CE("ROSConDemoEditorService"));
  32. }
  33. void ROSConDemoEditorSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  34. {
  35. required.push_back(AZ_CRC_CE("ROS2EditorService"));
  36. ROSConDemoSystemComponent::GetRequiredServices(required);
  37. }
  38. void ROSConDemoEditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  39. {
  40. ROSConDemoSystemComponent::GetDependentServices(dependent);
  41. }
  42. void ROSConDemoEditorSystemComponent::Activate()
  43. {
  44. AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
  45. }
  46. void ROSConDemoEditorSystemComponent::Deactivate()
  47. {
  48. AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
  49. }
  50. void ROSConDemoEditorSystemComponent::OnStartPlayInEditor()
  51. {
  52. ROSConDemoSystemComponent::Activate();
  53. }
  54. void ROSConDemoEditorSystemComponent::OnStopPlayInEditorBegin()
  55. {
  56. ROSConDemoSystemComponent::Deactivate();
  57. }
  58. } // namespace ROS2