void SetBodyPartVisible(FPSBodyPart part, bool visible) { foreach (var rendEntry in materialData) { var mats = rendEntry.renderer.sharedMaterials; var indices = rendEntry.matLookup[part]; foreach (var index in indices) { mats[index] = visible ? rendEntry.originalMaterials[index] : invisibleMaterial; } rendEntry.renderer.sharedMaterials = mats; } }
public void ShowBodyPart(FPSBodyPart part) { SetBodyPartVisible(part, true); }
public void HideBodyPart(FPSBodyPart part) { SetBodyPartVisible(part, false); }
public FPSMaterialEntry(Material mat) { material = mat; bodyPart = GuessBodyPart(mat.name); }