From 61d6e9bf192ffa54abc57bab69b1bd88c3b8d62b Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 29 Sep 2021 19:55:57 +0800 Subject: *misc --- Assets/Scripts/Unit/Controller/UnitController.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'Assets/Scripts/Unit/Controller/UnitController.cs') diff --git a/Assets/Scripts/Unit/Controller/UnitController.cs b/Assets/Scripts/Unit/Controller/UnitController.cs index 34490feb..c75b32b3 100644 --- a/Assets/Scripts/Unit/Controller/UnitController.cs +++ b/Assets/Scripts/Unit/Controller/UnitController.cs @@ -42,6 +42,8 @@ public class UnitController : MonoBehaviour/*, Interactable*/ public UnitBody unitBody; + public UnitLensEffect unitLensEffect; + public GameObject unitObj; // 角色模型 protected List unitComponents; @@ -93,6 +95,18 @@ public class UnitController : MonoBehaviour/*, Interactable*/ } } + public TRS trs + { + get + { + TRS trs = new TRS(); + trs.position = position; + trs.rotation = rotation; + trs.scale = lossyScale; + return trs; + } + } + public virtual Vector3 center { get @@ -166,6 +180,9 @@ public class UnitController : MonoBehaviour/*, Interactable*/ unitRender = GetOrAddUnitComponent(); unitRender.Initialize(); + unitLensEffect = GetOrAddUnitComponent(); + unitLensEffect.Initialize(); + unitDetail = gameObject.GetComponentInChildren(); } @@ -194,7 +211,8 @@ public class UnitController : MonoBehaviour/*, Interactable*/ unitAnimation.OnUpdate(); unitSkill.OnUpdate(); unitRootMotion.OnUpdate(); - } + unitLensEffect.OnUpdate(); + } public virtual void OnDestroy() { @@ -232,6 +250,7 @@ public class UnitController : MonoBehaviour/*, Interactable*/ public UnitSnapshotInfo TakeSnapshot() { UnitSnapshotInfo snapshot = new UnitSnapshotInfo(); + snapshot.trs = new TRS(unitObj.transform.position, unitObj.transform.rotation, unitObj.transform.lossyScale); snapshot.unit = this; snapshot.animStateHash = unitAnimation.baseLayer.stateHash; snapshot.normalizedTime = unitAnimation.baseLayer.playbackNormalizedTime; -- cgit v1.1-26-g67d0