Ejemplo n.º 1
0
 // Token: 0x06001375 RID: 4981 RVA: 0x0005F000 File Offset: 0x0005D200
 private void SetupPrint()
 {
     this.hasSetupOnce   = true;
     this.characterModel = base.GetComponent <CharacterModel>();
     if (this.characterModel)
     {
         for (int i = 0; i < this.characterModel.rendererInfos.Length; i++)
         {
             CharacterModel.RendererInfo rendererInfo = this.characterModel.rendererInfos[i];
             Material material = UnityEngine.Object.Instantiate <Material>(rendererInfo.defaultMaterial);
             if (material.shader == this.printShader)
             {
                 material.EnableKeyword("PRINT_CUTOFF");
                 this.materialsList.Add(material);
                 this.rendererList.Add(rendererInfo.renderer);
                 rendererInfo.defaultMaterial         = material;
                 this.characterModel.rendererInfos[i] = rendererInfo;
             }
         }
     }
     else
     {
         foreach (Renderer renderer in base.GetComponentsInChildren <Renderer>())
         {
             this.rendererList.Add(renderer);
             this.materialsList.Add(renderer.material);
         }
     }
     this.age = 0f;
 }
Ejemplo n.º 2
0
        // Token: 0x06000D24 RID: 3364 RVA: 0x00040FFC File Offset: 0x0003F1FC
        private void UpdateMaterials()
        {
            if (this.visibility == VisibilityLevel.Invisible)
            {
                for (int i = this.rendererInfos.Length - 1; i >= 0; i--)
                {
                    CharacterModel.RendererInfo rendererInfo = this.rendererInfos[i];
                    rendererInfo.renderer.shadowCastingMode = ShadowCastingMode.Off;
                    rendererInfo.renderer.enabled           = false;
                }
            }
            else
            {
                for (int j = this.rendererInfos.Length - 1; j >= 0; j--)
                {
                    CharacterModel.RendererInfo rendererInfo2 = this.rendererInfos[j];
                    rendererInfo2.renderer.shadowCastingMode = rendererInfo2.defaultShadowCastingMode;
                    rendererInfo2.renderer.enabled           = true;
                }
            }
            Color value = Color.black;

            if (this.body && this.body.healthComponent)
            {
                if (this.body.healthComponent.shield > 0f)
                {
                    value = CharacterModel.hitFlashShieldColor * Mathf.Clamp01(1f - this.body.healthComponent.timeSinceLastHit / 0.15f);
                }
                else
                {
                    value = CharacterModel.hitFlashBaseColor * Mathf.Clamp01(1f - this.body.healthComponent.timeSinceLastHit / 0.15f);
                }
            }
            for (int k = this.rendererInfos.Length - 1; k >= 0; k--)
            {
                Renderer renderer = this.rendererInfos[k].renderer;
                this.UpdateRendererMaterials(renderer, this.rendererInfos[k].defaultMaterial, this.rendererInfos[k].ignoreOverlays);
                renderer.GetPropertyBlock(this.propertyStorage);
                this.propertyStorage.SetColor("_FlashColor", value);
                this.propertyStorage.SetFloat("_Fade", this.fade);
                this.propertyStorage.SetFloat("_EliteIndex", (float)(this.myEliteIndex + 1));
                this.propertyStorage.SetFloat("_LimbPrimeMask", this.limbFlagSet.materialMaskValue);
                renderer.SetPropertyBlock(this.propertyStorage);
            }
            for (int l = 0; l < this.parentedPrefabDisplays.Count; l++)
            {
                ItemDisplay itemDisplay = this.parentedPrefabDisplays[l].itemDisplay;
                itemDisplay.SetVisibilityLevel(this.visibility);
                for (int m = 0; m < itemDisplay.rendererInfos.Length; m++)
                {
                    Renderer renderer2 = itemDisplay.rendererInfos[m].renderer;
                    renderer2.GetPropertyBlock(this.propertyStorage);
                    this.propertyStorage.SetColor("_FlashColor", value);
                    this.propertyStorage.SetFloat("_Fade", this.fade);
                    renderer2.SetPropertyBlock(this.propertyStorage);
                }
            }
        }
Ejemplo n.º 3
0
        // Token: 0x06000D92 RID: 3474 RVA: 0x0003CE40 File Offset: 0x0003B040
        public void SetVisibilityLevel(VisibilityLevel newVisibilityLevel)
        {
            if (this.visibilityLevel != newVisibilityLevel)
            {
                this.visibilityLevel = newVisibilityLevel;
                switch (this.visibilityLevel)
                {
                case VisibilityLevel.Invisible:
                    for (int i = 0; i < this.rendererInfos.Length; i++)
                    {
                        CharacterModel.RendererInfo rendererInfo = this.rendererInfos[i];
                        rendererInfo.renderer.enabled           = false;
                        rendererInfo.renderer.shadowCastingMode = ShadowCastingMode.Off;
                    }
                    return;

                case VisibilityLevel.Cloaked:
                    for (int j = 0; j < this.rendererInfos.Length; j++)
                    {
                        CharacterModel.RendererInfo rendererInfo2 = this.rendererInfos[j];
                        rendererInfo2.renderer.enabled           = true;
                        rendererInfo2.renderer.shadowCastingMode = ShadowCastingMode.Off;
                        rendererInfo2.renderer.material          = CharacterModel.cloakedMaterial;
                    }
                    return;

                case VisibilityLevel.Revealed:
                    for (int k = 0; k < this.rendererInfos.Length; k++)
                    {
                        CharacterModel.RendererInfo rendererInfo3 = this.rendererInfos[k];
                        rendererInfo3.renderer.enabled           = true;
                        rendererInfo3.renderer.shadowCastingMode = ShadowCastingMode.Off;
                        rendererInfo3.renderer.material          = CharacterModel.revealedMaterial;
                    }
                    return;

                case VisibilityLevel.Visible:
                    for (int l = 0; l < this.rendererInfos.Length; l++)
                    {
                        CharacterModel.RendererInfo rendererInfo4 = this.rendererInfos[l];
                        rendererInfo4.renderer.enabled           = true;
                        rendererInfo4.renderer.shadowCastingMode = ShadowCastingMode.On;
                        rendererInfo4.renderer.material          = rendererInfo4.defaultMaterial;
                    }
                    break;

                default:
                    return;
                }
            }
        }
Ejemplo n.º 4
0
 // Token: 0x06001C63 RID: 7267 RVA: 0x000792D4 File Offset: 0x000774D4
 private void Bake()
 {
     if (this.runtimeSkin != null)
     {
         return;
     }
     this.runtimeSkin = new SkinDef.RuntimeSkin();
     SkinDef.< > c__DisplayClass14_0 CS$ < > 8__locals1;
     CS$ < > 8__locals1.rendererInfoTemplates         = new List <SkinDef.RendererInfoTemplate>();
     CS$ < > 8__locals1.gameObjectActivationTemplates = new List <SkinDef.GameObjectActivationTemplate>();
     CS$ < > 8__locals1.meshReplacementTemplates      = new List <SkinDef.MeshReplacementTemplate>();
     foreach (SkinDef skinDef in this.baseSkins)
     {
         skinDef.Bake();
         SkinDef.RendererInfoTemplate[] rendererInfoTemplates = skinDef.runtimeSkin.rendererInfoTemplates;
         for (int j = 0; j < rendererInfoTemplates.Length; j++)
         {
             SkinDef.< Bake > g__AddRendererInfoTemplate | 14_0 (rendererInfoTemplates[j], ref CS$ < > 8__locals1);
         }
         SkinDef.GameObjectActivationTemplate[] gameObjectActivationTemplates = skinDef.runtimeSkin.gameObjectActivationTemplates;
         for (int j = 0; j < gameObjectActivationTemplates.Length; j++)
         {
             SkinDef.< Bake > g__AddGameObjectActivationTemplate | 14_1 (gameObjectActivationTemplates[j], ref CS$ < > 8__locals1);
         }
         SkinDef.MeshReplacementTemplate[] meshReplacementTemplates = skinDef.runtimeSkin.meshReplacementTemplates;
         for (int j = 0; j < meshReplacementTemplates.Length; j++)
         {
             SkinDef.< Bake > g__AddMeshReplacementTemplate | 14_2 (meshReplacementTemplates[j], ref CS$ < > 8__locals1);
         }
     }
     for (int k = 0; k < this.rendererInfos.Length; k++)
     {
         ref CharacterModel.RendererInfo ptr = ref this.rendererInfos[k];
         if (!ptr.renderer)
         {
             Debug.LogErrorFormat("Skin {0} has an empty renderer field in its rendererInfos.", new object[]
             {
                 this
             });
         }
         else
         {
             SkinDef.< Bake > g__AddRendererInfoTemplate | 14_0 (new SkinDef.RendererInfoTemplate
             {
                 data = ptr,
                 path = Util.BuildPrefabTransformPath(this.rootObject.transform, ptr.renderer.transform, false)
             }, ref CS$ < > 8__locals1);
         }
     }
        // Token: 0x060013C0 RID: 5056 RVA: 0x00060888 File Offset: 0x0005EA88
        private void Setup()
        {
            this.hasSetupOnce   = true;
            this.characterModel = base.GetComponent <CharacterModel>();
            if (this.characterModel)
            {
                for (int i = 0; i < this.characterModel.rendererInfos.Length; i++)
                {
                    CharacterModel.RendererInfo rendererInfo = this.characterModel.rendererInfos[i];
                    Material material = UnityEngine.Object.Instantiate <Material>(rendererInfo.defaultMaterial);
                    if (material.shader == this.printShader)
                    {
                        this.materialsList.Add(material);
                        this.rendererList.Add(rendererInfo.renderer);
                        rendererInfo.defaultMaterial         = material;
                        this.characterModel.rendererInfos[i] = rendererInfo;
                    }
                    Renderer renderer = this.rendererList[i];
                    this._propBlock = new MaterialPropertyBlock();
                    renderer.GetPropertyBlock(this._propBlock);
                    this._propBlock.SetFloat("_RedChannelBias", UnityEngine.Random.Range(this.minRedBias, this.maxRedBias));
                    this._propBlock.SetFloat("_BlueChannelBias", UnityEngine.Random.Range(this.minBlueBias, this.maxBlueBias));
                    this._propBlock.SetFloat("_GreenChannelBias", UnityEngine.Random.Range(this.minGreenBias, this.maxGreenBias));
                    renderer.SetPropertyBlock(this._propBlock);
                }
                return;
            }
            Renderer componentInChildren = base.GetComponentInChildren <Renderer>();
            Material material2           = UnityEngine.Object.Instantiate <Material>(componentInChildren.material);

            this.materialsList.Add(material2);
            componentInChildren.material = material2;
            this._propBlock = new MaterialPropertyBlock();
            componentInChildren.GetPropertyBlock(this._propBlock);
            this._propBlock.SetFloat("_RedChannelBias", UnityEngine.Random.Range(this.minRedBias, this.maxRedBias));
            this._propBlock.SetFloat("_BlueChannelBias", UnityEngine.Random.Range(this.minBlueBias, this.maxBlueBias));
            this._propBlock.SetFloat("_GreenChannelBias", UnityEngine.Random.Range(this.minGreenBias, this.maxGreenBias));
            componentInChildren.SetPropertyBlock(this._propBlock);
        }