private void initialize() { meshes = part.transform.FindChildren(decalMeshName); ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData); ConfigNode[] decalNodes = node.GetNodes("DECAL"); int len = decalNodes.Length; possibleDecals = new SSTUDecal[len]; for (int i = 0; i < len; i++) { possibleDecals[i] = new SSTUDecal(decalNodes[i]); } SSTUDecal currentDecalObj = Array.Find(possibleDecals, m => m.name == currentDecal); if (currentDecalObj == null && len > 0) { currentDecalObj = possibleDecals[0]; currentDecal = currentDecalObj.name; } else if (currentDecalObj == null) { MonoBehaviour.print("ERROR: NO decals found to load for part: " + part.name); } foreach (Transform mesh in meshes) { currentDecalObj.enable(mesh); } }
public void nextDecalEvent() { SSTUDecal next = SSTUUtils.findNext(possibleDecals, m => m.name == currentDecal, false); currentDecal = next.name; foreach (Transform mesh in meshes) { next.enable(mesh); } }