using System; using UnityEngine; namespace CustomCosmeticLoader { public static class Shared { private static Cosmetic skinToHijack; private static bool noSkinToHijack = false; public static Cosmetic SkinToHijack { get { if (noSkinToHijack) return null; if (skinToHijack == null) { DetermineSkinToHijack(); if (skinToHijack == null) Debug.LogWarning("Couldn't hijack skin " + Config.skinNameToHijack); } return skinToHijack; } } private static void DetermineSkinToHijack() { foreach (Cosmetic skin in CosmeticManager.Skins) { if (skin.Id == Config.skinNameToHijack) { skinToHijack = skin; break; } } } public static void ApplyCustomTexture(GameObject marbleObject) { MeshRenderer[] componentsInChildren = marbleObject.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; foreach (Material material in materials) material.mainTexture = Config.skins[Config.currentSkin]; } } } }