using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// Util class for Loading Models
/// </summary>
public class ModelLoader
{
    public static List<ChildModel> LoadChildModels(string[] port, string[] nameHuman, string[] nameId, Mesh[] meshes, Material[] mats, List<Port>[] ports, int fromMesh = 0, int toMesh = -1)
    {
        Debug.Log("LoadChildModels " + fromMesh + " to " + toMesh + " from " + mats.Length + " meshes");
        List<ChildModel> models = new List<ChildModel>();
        if (toMesh == -1)
        {
            toMesh = meshes.Length;
        }
        for (int i = 0; i < toMesh - fromMesh; i++)
        {
            Debug.Log($"{i}. {nameId[i]}:{nameHuman[i]} with {port.Length} ports");
            models.Add(new ChildModel(port[i], nameHuman[i], nameId[i], meshes[fromMesh + i], mats[i], ports[i]));
        }
        return models;
    }
}
