EntityReferenceComponentController.h 1.8 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. #pragma once
  9. #include <AzCore/Component/Component.h>
  10. #include <AzCore/Component/TransformBus.h>
  11. #include <AtomLyIntegration/CommonFeatures/Scripting/EntityReferenceRequestBus.h>
  12. #include <AtomLyIntegration/CommonFeatures/Scripting/EntityReferenceComponentConfig.h>
  13. namespace AZ
  14. {
  15. namespace Render
  16. {
  17. class EntityReferenceComponentController final
  18. : public EntityReferenceRequestBus::Handler
  19. {
  20. public:
  21. friend class EditorEntityReferenceComponent;
  22. AZ_TYPE_INFO(AZ::Render::EntityReferenceComponentController, "{89D1D8DE-AC1F-4069-8884-5A04582C2EB1}");
  23. static void Reflect(AZ::ReflectContext* context);
  24. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  25. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  26. EntityReferenceComponentController() = default;
  27. EntityReferenceComponentController(const EntityReferenceComponentConfig& config);
  28. void Activate(EntityId entityId);
  29. void Deactivate();
  30. void SetConfiguration(const EntityReferenceComponentConfig& config);
  31. const EntityReferenceComponentConfig& GetConfiguration() const { return m_configuration; }
  32. // EntityReferenceRequestBus Overrides
  33. virtual AZStd::vector<EntityId> GetEntityReferences() const override;
  34. private:
  35. AZ_DISABLE_COPY(EntityReferenceComponentController);
  36. EntityReferenceComponentConfig m_configuration;
  37. EntityId m_entityId;
  38. };
  39. }
  40. }