SkidSteeringModelComponent.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 "SkidSteeringModelComponent.h"
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/EditContextConstants.inl>
  11. #include <AzCore/Serialization/SerializeContext.h>
  12. namespace ROS2::VehicleDynamics
  13. {
  14. void SkidSteeringModelComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. SkidSteeringDriveModel::Reflect(context);
  17. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  18. {
  19. serialize->Class<SkidSteeringModelComponent, VehicleModelComponent>()->Version(3)->Field(
  20. "DriveModel", &SkidSteeringModelComponent::m_driveModel);
  21. if (AZ::EditContext* ec = serialize->GetEditContext())
  22. {
  23. ec->Class<SkidSteeringModelComponent>("Skid Steering Vehicle Model", "Skid steering vehicle model component")
  24. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  25. ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
  26. ->Attribute(AZ::Edit::Attributes::Category, "ROS2")
  27. ->DataElement(
  28. AZ::Edit::UIHandlers::Default,
  29. &SkidSteeringModelComponent::m_driveModel,
  30. "Drive model",
  31. "Settings of the selected drive model");
  32. }
  33. }
  34. }
  35. void SkidSteeringModelComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  36. {
  37. provided.push_back(AZ_CRC_CE("SkidSteeringModelService"));
  38. }
  39. void SkidSteeringModelComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  40. {
  41. incompatible.push_back(AZ_CRC_CE("SkidSteeringModelService"));
  42. }
  43. VehicleDynamics::DriveModel* SkidSteeringModelComponent::GetDriveModel()
  44. {
  45. return &m_driveModel;
  46. };
  47. void SkidSteeringModelComponent::Activate()
  48. {
  49. VehicleModelComponent::Activate();
  50. m_driveModel.Activate(m_vehicleConfiguration);
  51. }
  52. } // namespace ROS2::VehicleDynamics