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/UnitSnapshot.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'Assets/Scripts/Unit/UnitSnapshot.cs') diff --git a/Assets/Scripts/Unit/UnitSnapshot.cs b/Assets/Scripts/Unit/UnitSnapshot.cs index 0515bf6f..f43189cb 100644 --- a/Assets/Scripts/Unit/UnitSnapshot.cs +++ b/Assets/Scripts/Unit/UnitSnapshot.cs @@ -18,19 +18,38 @@ public struct UnitSnapshotInfo // 角色快照,用于lens effect public class UnitSnapshot : MonoBehaviour { + [HideInInspector] public UnitController owner; public Animator animator; + public Renderer[] renderers; + + public bool active + { + get + { + return this.gameObject.activeSelf; + } + set + { + this.gameObject.SetActive(value); + } + } public void Initialize(UnitController prototype) { + owner = prototype; animator.runtimeAnimatorController = prototype.unitAnimation.animator.runtimeAnimatorController; + animator.speed = 0; } public void ApplySnapshot(UnitSnapshotInfo info) { - animator.Play(info.animStateHash, 0, info.normalizedTime); + active = true; animator.speed = 0.02f; + animator.Play(info.animStateHash, 0, info.normalizedTime); animator.Update(1 / 60f); + animator.speed = 0; + active = false; } -} \ No newline at end of file +} -- cgit v1.1-26-g67d0