summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Unit/UnitSnapshot.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Unit/UnitSnapshot.cs')
-rw-r--r--Assets/Scripts/Unit/UnitSnapshot.cs23
1 files changed, 21 insertions, 2 deletions
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
+}