Exemple #1
0
        private static void PostProcess(ModComponent modComponent)
        {
            modComponent.gameObject.layer = vp_Layer.Gear;

            GearItem gearItem = modComponent.GetComponent <GearItem>();

            gearItem.m_SkinnedMeshRenderers = ModUtils.NotNull <SkinnedMeshRenderer>(gearItem.m_SkinnedMeshRenderers);

            GameObject   template     = Resources.Load <GameObject>("GEAR_CoffeeCup");
            MeshRenderer meshRenderer = template.GetComponentInChildren <MeshRenderer>();

            foreach (var eachMeshRenderer in gearItem.m_MeshRenderers)
            {
                foreach (var eachMaterial in eachMeshRenderer.materials)
                {
                    if (eachMaterial.shader.name == "Standard")
                    {
                        eachMaterial.shader         = meshRenderer.material.shader;
                        eachMaterial.shaderKeywords = meshRenderer.material.shaderKeywords;

                        if (eachMaterial.GetTexture("_dmg_texture") is null)
                        {
                            eachMaterial.SetTexture("_dmg_texture", eachMaterial.GetTexture("_MainTex"));
                        }
                    }
                }
            }

            ConsoleWaitlist.MaybeRegisterConsoleGearName(modComponent.GetEffectiveConsoleName(), modComponent.name);

            UnityEngine.Object.DontDestroyOnLoad(modComponent.gameObject);
        }
Exemple #2
0
        private static void PostProcess(ModComponent modComponent)
        {
            modComponent.gameObject.layer = vp_Layer.Gear;

            GearItem gearItem = modComponent.GetComponent <GearItem>();

            gearItem.m_SkinnedMeshRenderers = ModUtils.NotNull(gearItem.m_SkinnedMeshRenderers);

            GameObject   template     = Resources.Load <GameObject>("GEAR_CoffeeCup");
            MeshRenderer meshRenderer = template.GetComponentInChildren <MeshRenderer>();

            foreach (var eachMeshRenderer in gearItem.m_MeshRenderers)
            {
                foreach (var eachMaterial in eachMeshRenderer.materials)
                {
                    if (eachMaterial.shader.name == "Standard")
                    {
                        Debug.Log("Updating shader of " + modComponent.name);
                        eachMaterial.shader         = meshRenderer.material.shader;
                        eachMaterial.shaderKeywords = meshRenderer.material.shaderKeywords;
                    }
                }
            }

            ModUtils.RegisterConsoleGearName(modComponent.GetEffectiveConsoleName(), modComponent.name);

            if (modComponent.Radial != Radial.None)
            {
                RadialConfigurator.RegisterGear(modComponent.Radial, modComponent.name);
            }

            UnityEngine.Object.DontDestroyOnLoad(modComponent.gameObject);
        }