//** GetClothSlotRecord ** //Return record of a selected cloth slot public BodyClothSlots GetClothSlotRecord(int idSlot, int idStructure) { BodyClothSlots recReturn = new BodyClothSlots(); if (clothSlots.Count == 0) { Debug.LogWarning("Cloth Slots table is empty. Returning null record."); } recReturn = clothSlots.Find(x => x.IDSlot == idSlot && x.IDStructure == idStructure); return(recReturn); }
//** AddClothSlot ** //Insert a new slot for cloth public int AddClothSlot(int idStructure, string partName, string objName) { int iReturn = 1; //Get number of new record if (clothSlots.Count(x => x.IDStructure == idStructure) > 0) { iReturn = clothSlots.OrderBy(x => x.IDSlot).Where(x => x.IDStructure == idStructure).Last().IDSlot + 1; } BodyClothSlots toAdd = new BodyClothSlots(); toAdd.IDStructure = idStructure; toAdd.SlotName = partName; toAdd.ObjectName = objName; toAdd.IDSlot = iReturn; clothSlots.Add(toAdd); return(iReturn); }