public bool AddPuzzle(Puzzle puzzle) { // Create CategoryComponent PuzzleComponent.Create(puzzle, transform); return(true); }
private void CreateCategory(Transform parenTransform) { // Get category ID var categoryComponent = parenTransform.GetComponent <CategoryComponent>(); int?categoryID = categoryComponent != null ? (int?)categoryComponent.CategoryData.ID : null; // Find all subCategories var subCategories = _Categories.Where(c => c.ParentID == categoryID); // Create category components foreach (Category subCategory in subCategories) { CreateCategory(CategoryComponent.Create(subCategory, parenTransform)); } // Find all puzzles var puzzles = _puzzles.Where(p => p.CategoryID == categoryID); // Create puzzle components foreach (var puzzle in puzzles) { PuzzleComponent.Create(puzzle, parenTransform); } }