using QFramework; using System.Collections; using System.Collections.Generic; using UnityEngine; using XMLTool; public class LineModeItem : MonoBehaviour { Shader shader; public Body3D.Body body; public LineModeItem Init(Body3D.Body body) { this.body = body; shader = GetComponent()?.material.shader; TypeEventSystem.Global.Register(OnChangeMatEvent).UnRegisterWhenGameObjectDestroyed(this); return this; } private void OnChangeMatEvent(OnChangeMat t) { if (t.shader != null) { GetComponent().material.shader = t.shader; if (body.lineModeWidth != 0) { GetComponent().material.SetFloat("_OutlineWidth", body.lineModeWidth); } } else { GetComponent().material.shader = this.shader; } } }