public static MaterialSound GetMaterialSound(Material material) { if (material == null) { return(MaterialSound.GENERIC); } string name; if (CustomTexture.IsCustomTexture(material)) { name = CustomTexture.GetBaseMaterialName(material); } else { name = material.name; } MaterialInfo info; // special alternate materials for game if (materialInfos.TryGetValue("$" + name, out info)) { return(info.sound); } if (materialInfos.TryGetValue(name, out info)) { return(info.sound); } return(MaterialSound.GENERIC); }
private static MessagePackObjectDictionary WriteMaterial(Material material) { var materialDict = new MessagePackObjectDictionary(); materialDict[FileKeys.MATERIAL_NAME] = material.name; string colorProp = CustomTexture.IsCustomTexture(material) ? null : ResourcesDirectory.MaterialColorProperty(material); if (colorProp != null) { materialDict[FileKeys.MATERIAL_COLOR] = WriteColor(material.GetColor(colorProp)); materialDict[FileKeys.MATERIAL_COLOR_STYLE] = ResourcesDirectory.GetMaterialColorStyle(material).ToString(); } return(materialDict); }