RecastNavigationMeshComponent.cpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 "RecastNavigationMeshComponent.h"
  9. #include <AzCore/Serialization/SerializeContext.h>
  10. namespace RecastNavigation
  11. {
  12. RecastNavigationMeshComponent::RecastNavigationMeshComponent(const RecastNavigationMeshConfig& config)
  13. : BaseClass(config)
  14. {
  15. }
  16. void RecastNavigationMeshComponent::Reflect(AZ::ReflectContext* context)
  17. {
  18. BaseClass::Reflect(context);
  19. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  20. {
  21. serializeContext->Class<RecastNavigationMeshComponent, BaseClass>()
  22. ->Version(1);
  23. }
  24. if (auto behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
  25. {
  26. behaviorContext->ConstantProperty("RecastNavigationMeshComponentTypeId", BehaviorConstant(AZ::Uuid(RecastNavigationMeshComponentTypeId)))
  27. ->Attribute(AZ::Script::Attributes::Module, "navigation")
  28. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
  29. behaviorContext->EBus<RecastNavigationMeshRequestBus>("RecastNavigationMeshRequestBus")
  30. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
  31. ->Attribute(AZ::Script::Attributes::Module, "navigation")
  32. ->Attribute(AZ::Script::Attributes::Category, "Recast Navigation")
  33. ->Event("UpdateNavigationMesh", &RecastNavigationMeshRequests::UpdateNavigationMeshBlockUntilCompleted)
  34. ->Event("UpdateNavigationMeshAsync", &RecastNavigationMeshRequests::UpdateNavigationMeshAsync);
  35. behaviorContext->Class<RecastNavigationMeshComponentController>()->RequestBus("RecastNavigationMeshRequestBus");
  36. behaviorContext->EBus<RecastNavigationMeshNotificationBus>("RecastNavigationMeshNotificationBus")
  37. ->Handler<RecastNavigationNotificationHandler>();
  38. }
  39. }
  40. } // namespace RecastNavigation