28 lines
729 B
C#
28 lines
729 B
C#
|
using HarmonyLib;
|
|||
|
using System;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace CustomCosmeticLoader.Patches
|
|||
|
{
|
|||
|
[HarmonyPatch(typeof(MarbleHolder))]
|
|||
|
[HarmonyPatch("SetMarble")]
|
|||
|
internal class MarbleHolderSetMarblePatch
|
|||
|
{
|
|||
|
static void Postfix(MarbleHolder __instance, Cosmetic marbleObject)
|
|||
|
{
|
|||
|
if (marbleObject.Id != "Swirl_M")
|
|||
|
return; // I only hijack this one skin, "Mirage"
|
|||
|
|
|||
|
MeshRenderer[] componentsInChildren = __instance.currentMarble.GetComponentsInChildren<MeshRenderer>();
|
|||
|
for (int i = 0; i < componentsInChildren.Length; i++)
|
|||
|
{
|
|||
|
Material[] materials = componentsInChildren[i].materials;
|
|||
|
foreach (Material material in materials)
|
|||
|
{
|
|||
|
material.mainTexture = PatchEntryPoint.skin;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|