Пример #1
0
        private static void UpdateHandMaterials(On.RoR2.CharacterModel.orig_UpdateMaterials orig, CharacterModel self)
        {
            orig(self);

            if (!HandsReady)
            {
                return;
            }

            if (self.body.IsLocalBody() && self.visibility != VisibilityLevel.Invisible)
            {
                foreach (CharacterModel.RendererInfo rendererInfo in dominantHand.currentHand.rendererInfos)
                {
                    if (!rendererInfo.renderer || !rendererInfo.defaultMaterial)
                    {
                        continue;
                    }
                    self.UpdateRendererMaterials(rendererInfo.renderer, rendererInfo.defaultMaterial, rendererInfo.ignoreOverlays);
                }

                foreach (CharacterModel.RendererInfo rendererInfo in nonDominantHand.currentHand.rendererInfos)
                {
                    if (!rendererInfo.renderer || !rendererInfo.defaultMaterial)
                    {
                        continue;
                    }
                    self.UpdateRendererMaterials(rendererInfo.renderer, rendererInfo.defaultMaterial, rendererInfo.ignoreOverlays);
                }
            }
        }
Пример #2
0
        private static void CharacterModelOnUpdateMaterials(On.RoR2.CharacterModel.orig_UpdateMaterials orig, CharacterModel self)
        {
            orig(self);

            //Vanilla elites aren't adjusted
            var eliteIndex = self.GetFieldValue <EliteIndex>("myEliteIndex");

            if (eliteIndex < EliteIndex.Count)
            {
                return;
            }

            var eliteDef        = EliteCatalog.GetEliteDef(eliteIndex);
            var rendererInfos   = self.baseRendererInfos;
            var propertyStorage = self.GetFieldValue <MaterialPropertyBlock>("propertyStorage");

            for (int i = rendererInfos.Length - 1; i >= 0; --i)
            {
                var      baseRendererInfo = rendererInfos[i];
                Renderer renderer         = baseRendererInfo.renderer;
                renderer.GetPropertyBlock(propertyStorage);
                propertyStorage.SetInt((int)CommonShaderProperties._EliteIndex, 0);
                propertyStorage.SetColor("_Color", eliteDef.color);
                renderer.SetPropertyBlock(propertyStorage);
            }
        }
Пример #3
0
        private void UpdateMaterialsHook(On.RoR2.CharacterModel.orig_UpdateMaterials orig, CharacterModel self)
        {
            orig(self);

            updateMaterialsEvent?.Invoke(self);
        }
Пример #4
0
 private void CharacterModel_UpdateMaterials(On.RoR2.CharacterModel.orig_UpdateMaterials orig, CharacterModel self)
 {
     CharacterModelMaterialOverrides.SetOverrideActive(self, "DasherDiscActive", self.visibility >= VisibilityLevel.Visible && self.body && self.body.HasBuff(buffDef));
     orig(self);
 }