/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include #include #include #include #include namespace UnitTest { AZStd::unique_ptr SpawnableTestFixture::CreateEntity(const char* entityName, AZ::EntityId parentId) { auto result = AZStd::make_unique(entityName); auto transformComponent = result->CreateComponent(); transformComponent->SetParent(parentId); return result; } AZ::Data::Asset SpawnableTestFixture::CreateSpawnableAsset(uint64_t entityCount) { // The life cycle of a spawnable is managed through the asset. AzFramework::Spawnable* spawnable = new AzFramework::Spawnable( AZ::Data::AssetId::CreateString("{612F2AB1-30DF-44BB-AFBE-17A85199F09E}:0"), AZ::Data::AssetData::AssetStatus::Ready); AzFramework::Spawnable::EntityList& entities = spawnable->GetEntities(); entities.reserve(entityCount); for (uint64_t i = 0; i < entityCount; i++) { entities.emplace_back(CreateEntity("Entity")); } return AZ::Data::Asset(spawnable, AZ::Data::AssetLoadBehavior::Default); } } // namespace UnitTest