RecastNavigationSystemComponent.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 <RecastNavigationSystemComponent.h>
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. namespace RecastNavigation
  12. {
  13. void RecastNavigationSystemComponent::Reflect(AZ::ReflectContext* context)
  14. {
  15. if (auto serialize = azrtti_cast<AZ::SerializeContext*>(context))
  16. {
  17. serialize->Class<RecastNavigationSystemComponent, AZ::Component>()
  18. ->Version(0)
  19. ;
  20. if (AZ::EditContext* editContext = serialize->GetEditContext())
  21. {
  22. editContext->Class<RecastNavigationSystemComponent>("RecastNavigation", "[System Component for the Recast Navigation gem]")
  23. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  24. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  25. ;
  26. }
  27. }
  28. }
  29. void RecastNavigationSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  30. {
  31. provided.push_back(AZ_CRC_CE("RecastNavigationService"));
  32. }
  33. void RecastNavigationSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  34. {
  35. incompatible.push_back(AZ_CRC_CE("RecastNavigationService"));
  36. }
  37. void RecastNavigationSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
  38. {
  39. }
  40. void RecastNavigationSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  41. {
  42. }
  43. RecastNavigationSystemComponent::RecastNavigationSystemComponent()
  44. {
  45. if (RecastNavigationInterface::Get() == nullptr)
  46. {
  47. RecastNavigationInterface::Register(this);
  48. }
  49. }
  50. RecastNavigationSystemComponent::~RecastNavigationSystemComponent()
  51. {
  52. if (RecastNavigationInterface::Get() == this)
  53. {
  54. RecastNavigationInterface::Unregister(this);
  55. }
  56. }
  57. void RecastNavigationSystemComponent::Init()
  58. {
  59. }
  60. void RecastNavigationSystemComponent::Activate()
  61. {
  62. RecastNavigationRequestBus::Handler::BusConnect();
  63. AZ::TickBus::Handler::BusConnect();
  64. }
  65. void RecastNavigationSystemComponent::Deactivate()
  66. {
  67. AZ::TickBus::Handler::BusDisconnect();
  68. RecastNavigationRequestBus::Handler::BusDisconnect();
  69. }
  70. void RecastNavigationSystemComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
  71. {
  72. }
  73. } // namespace RecastNavigation