using System; using System.Collections.Generic; using MU3.Sys; using UnityEngine; namespace MU3 { // Token: 0x0200073D RID: 1853 public class MU3HairHighlight : MonoBehaviour { // Token: 0x06002FDA RID: 12250 RVA: 0x00100440 File Offset: 0x00100440 private void Start() { if (null == this.targetRenderer_) { List list = new List(16); base.GetComponentsInChildren(true, list); for (int i = 0; i < list.Count; i++) { Material[] materials = list[i].materials; for (int j = 0; j < materials.Length; j++) { if ("MU3/ToonEdge/Hair" == materials[j].shader.name) { this.targetRenderer_ = list[i]; this.targetMaterialIndex_ = j; this.materials_ = materials; i = list.Count; break; } } } } } // Token: 0x06002FDB RID: 12251 RVA: 0x001004EC File Offset: 0x001004EC private static Transform findNode(Transform root, string name) { int childCount = root.childCount; for (int i = 0; i < childCount; i++) { Transform child = root.GetChild(i); if (name == child.name) { return child; } Transform transform = MU3HairHighlight.findNode(child, name); if (null != transform) { return transform; } } return null; } // Token: 0x06002FDC RID: 12252 RVA: 0x00100544 File Offset: 0x00100544 private void OnEnable() { if (null == this.targetNode_) { this.targetNode_ = MU3HairHighlight.findNode(base.transform, "head"); } } // Token: 0x06002FDD RID: 12253 RVA: 0x00100570 File Offset: 0x00100570 private void Update() { if (null == this.targetNode_ || null == this.targetRenderer_) { return; } int shaderPropertyID_HightlightSphere = Const.ShaderPropertyID_HightlightSphere; int shaderPropertyID_HightlightUp = Const.ShaderPropertyID_HightlightUp; Vector3 vector = this.targetNode_.rotation * MU3HairHighlight.Rotation * Vector3.up; Vector3 vector2 = this.targetNode_.transform.TransformPoint(MU3HairHighlight.Position); this.materials_[this.targetMaterialIndex_].SetVector(shaderPropertyID_HightlightSphere, vector2); this.materials_[this.targetMaterialIndex_].SetVector(shaderPropertyID_HightlightUp, vector); } // Token: 0x04005562 RID: 21858 public const float SpecularSphereSize = 0.2f; // Token: 0x04005563 RID: 21859 public const string TargetShaderName = "MU3/ToonEdge/Hair"; // Token: 0x04005564 RID: 21860 public const string HeadNullName = "head"; // Token: 0x04005565 RID: 21861 private static readonly Vector3 Position = new Vector3(-0.2f, 0.053f, 0f); // Token: 0x04005566 RID: 21862 private static readonly Quaternion Rotation = Quaternion.Euler(90f, 0f, 90f); // Token: 0x04005567 RID: 21863 public Renderer targetRenderer_; // Token: 0x04005568 RID: 21864 public int targetMaterialIndex_; // Token: 0x04005569 RID: 21865 private Transform targetNode_; // Token: 0x0400556A RID: 21866 private Material[] materials_; } }