EntityProvider.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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/Entity.h>
  10. #include <AzCore/Math/Uuid.h>
  11. #include <AzCore/std/containers/vector.h>
  12. #include <AzCore/std/smart_ptr/shared_ptr.h>
  13. namespace Blast
  14. {
  15. //! Abstracts away creation of an entity with components for convenience.
  16. class EntityProvider
  17. {
  18. public:
  19. static AZStd::shared_ptr<EntityProvider> Create();
  20. virtual ~EntityProvider() = default;
  21. //! Returns an entity with the specified components.
  22. //! @note If any of the components failed to be created, returns a nullptr instead.
  23. virtual AZStd::shared_ptr<AZ::Entity> CreateEntity(const AZStd::vector<AZ::Uuid>& componentIds) = 0;
  24. };
  25. class EntityProviderImpl : public EntityProvider
  26. {
  27. public:
  28. ~EntityProviderImpl() = default;
  29. AZStd::shared_ptr<AZ::Entity> CreateEntity(const AZStd::vector<AZ::Uuid>& componentIds) override;
  30. };
  31. } // namespace Blast