NamedPoseComponent.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 "NamedPoseComponent.h"
  9. namespace SimulationInterfaces
  10. {
  11. NamedPoseComponent::NamedPoseComponent(const NamedPose& config)
  12. : m_config(config)
  13. {
  14. }
  15. void NamedPoseComponent::Activate()
  16. {
  17. auto entityId = GetEntityId();
  18. NamedPoseComponentRequestBus::Handler::BusConnect(entityId);
  19. NamedPoseManagerRequestBus::Broadcast(&NamedPoseManagerRequests::RegisterNamedPose, entityId);
  20. }
  21. void NamedPoseComponent::Deactivate()
  22. {
  23. auto entityId = GetEntityId();
  24. NamedPoseManagerRequestBus::Broadcast(&NamedPoseManagerRequests::UnregisterNamedPose, entityId);
  25. NamedPoseComponentRequestBus::Handler::BusDisconnect();
  26. }
  27. void NamedPoseComponent::Reflect(AZ::ReflectContext* context)
  28. {
  29. NamedPose::Reflect(context);
  30. if (auto* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  31. {
  32. serialize->Class<NamedPoseComponent, AZ::Component>()->Version(0)->Field("NamedPoseConfig", &NamedPoseComponent::m_config);
  33. }
  34. }
  35. } // namespace SimulationInterfaces