RobotVacuumSampleSystemComponent.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 <AzCore/Serialization/SerializeContext.h>
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/EditContextConstants.inl>
  11. #include "RobotVacuumSampleSystemComponent.h"
  12. namespace RobotVacuumSample
  13. {
  14. void RobotVacuumSampleSystemComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  17. {
  18. serialize->Class<RobotVacuumSampleSystemComponent, AZ::Component>()
  19. ->Version(0)
  20. ;
  21. if (AZ::EditContext* ec = serialize->GetEditContext())
  22. {
  23. ec->Class<RobotVacuumSampleSystemComponent>("RobotVacuumSample", "The base Robot Vacuum Sample component.")
  24. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  25. ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
  26. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  27. ;
  28. }
  29. }
  30. }
  31. void RobotVacuumSampleSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  32. {
  33. provided.push_back(AZ_CRC("RobotVacuumSampleService"));
  34. }
  35. void RobotVacuumSampleSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  36. {
  37. incompatible.push_back(AZ_CRC("RobotVacuumSampleService"));
  38. }
  39. void RobotVacuumSampleSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
  40. {
  41. }
  42. void RobotVacuumSampleSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  43. {
  44. }
  45. RobotVacuumSampleSystemComponent::RobotVacuumSampleSystemComponent()
  46. {
  47. if (RobotVacuumSampleInterface::Get() == nullptr)
  48. {
  49. RobotVacuumSampleInterface::Register(this);
  50. }
  51. }
  52. RobotVacuumSampleSystemComponent::~RobotVacuumSampleSystemComponent()
  53. {
  54. if (RobotVacuumSampleInterface::Get() == this)
  55. {
  56. RobotVacuumSampleInterface::Unregister(this);
  57. }
  58. }
  59. void RobotVacuumSampleSystemComponent::Init()
  60. {
  61. }
  62. void RobotVacuumSampleSystemComponent::Activate()
  63. {
  64. RobotVacuumSampleRequestBus::Handler::BusConnect();
  65. }
  66. void RobotVacuumSampleSystemComponent::Deactivate()
  67. {
  68. RobotVacuumSampleRequestBus::Handler::BusDisconnect();
  69. }
  70. }