EditorRecastNavigationMeshComponent.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #pragma once
  9. #include <AzCore/Component/Component.h>
  10. #include <Components/RecastNavigationMeshComponent.h>
  11. #include <Misc/RecastNavigationConstants.h>
  12. #include <Misc/RecastNavigationMeshComponentController.h>
  13. #include <Misc/RecastNavigationMeshConfig.h>
  14. #include <ToolsComponents/EditorComponentAdapter.h>
  15. #include <ToolsComponents/EditorComponentBase.h>
  16. namespace RecastNavigation
  17. {
  18. //! Editor version of @RecastNavigationMeshComponent.
  19. class EditorRecastNavigationMeshComponent final
  20. : public AzToolsFramework::Components::EditorComponentAdapter<RecastNavigationMeshComponentController,
  21. RecastNavigationMeshComponent, RecastNavigationMeshConfig>
  22. {
  23. public:
  24. using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<RecastNavigationMeshComponentController, RecastNavigationMeshComponent, RecastNavigationMeshConfig>;
  25. AZ_EDITOR_COMPONENT(EditorRecastNavigationMeshComponent, EditorRecastNavigationMeshComponentTypeId, BaseClass);
  26. static void Reflect(AZ::ReflectContext* context);
  27. EditorRecastNavigationMeshComponent() = default;
  28. explicit EditorRecastNavigationMeshComponent(const RecastNavigationMeshConfig& config);
  29. void Activate() override;
  30. void Deactivate() override;
  31. void BuildGameEntity(AZ::Entity* gameEntity) override;
  32. //! Enables or disables in-Editor preview of navigation mesh without entering game mode.
  33. //! @param enable if true, the preview will be enabled
  34. void SetEditorPreview(bool enable);
  35. void OnEditorUpdateTick();
  36. AZ::u32 OnConfigurationChanged() override;
  37. private:
  38. AZ::ScheduledEvent m_inEditorUpdateTick{ [this]() {OnEditorUpdateTick(); }, AZ::Name("EditorRecastNavigationMeshTick") };
  39. };
  40. } // namespace RecastNavigation