private void GetConstructBuildingEntity() { // Building to Construct Tag => Reference Component EntityQuery notifyQuery = GetEntityQuery(typeof(ConstructionTaskNotify)); if (notifyQuery.IsEmpty) { this.Enabled = false; return; } prefabSelectedNotify = notifyQuery.ToEntityArray(Allocator.Temp)[0]; var notify = EntityManager.GetComponentData <ConstructionTaskNotify>(prefabSelectedNotify).task; // Validation if (!EntityManager.Exists(notify)) { return; } task = EntityManager.GetComponentData <ConstructionTask>(notify); EntityManager.DestroyEntity(notify); }
// Should be converted one time in the GameObjectConversionGroup public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { ConstructionTask task = default(ConstructionTask); task.buildingPrefab = conversionSystem.GetPrimaryEntity(building.buildingPrefab); task.previewPrefab = conversionSystem.GetPrimaryEntity(building.previewPrefab); task.isAttackable = building.isAttackable; task.constructionTime = building.constructionTime; task.durability = building.durability; prices = building.prices; dstManager.AddComponentData(entity, task); isConverted = true; taskEntity = entity; }