private void OnModuleButton(ModuleScriptableObject module) { var canvas = GetComponentInParent <Canvas>().rootCanvas; ModuleItem moduleItem = Instantiate(modulePrefab, canvas.transform).GetComponent <ModuleItem>(); moduleItem.SetUpItem(module, ShipBuilder.SlotSize); ModuleItem.SetSelectedItem(moduleItem); }
public void Decompress(CompressedSlot[,] compressedGrid) { for (int i = 0; i < gridSize.y; i++) { for (int j = 0; j < gridSize.x; j++) { CompressedSlot slot = compressedGrid[i, j]; if (slot != null && slot.Module != null) { var canvas = GetComponentInParent <Canvas>().rootCanvas; ModuleItem moduleItem = Instantiate(modulePrefab, canvas.transform).GetComponent <ModuleItem>(); moduleItem.SetUpItem(slot.Module, ShipBuilder.SlotSize); ActiveModulePos = slot.ModuleStartPos; StoreModule(moduleItem); } } } }