blob: ec04f3be9c01df11898b192a547f140fe0f99a0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// 单个残影的参数
public struct AfterImageAvatarInfo
{
}
public class AfterImageAvatar : MonoBehaviour
{
#region inspector
public Renderer[] renderers;
public Animator animator;
#endregion
float m_CurTime;
float m_LifeTime;
public void Initialize(AfterImageAvatarInfo info)
{
}
public void Initialize(UnitController prototype)
{
transform.position = prototype.transform.position;
animator.runtimeAnimatorController = prototype.unitAnimation.animator.runtimeAnimatorController;
animator.Play(prototype.unitAnimation.baseLayer.stateHash, 0, prototype.unitAnimation.baseLayer.playbackNormalizedTime);
animator.speed = 0.02f;
animator.Update(1 / 60f);
m_LifeTime = 0.2f;
}
public void Update()
{
m_CurTime += Time.deltaTime;
if (m_CurTime > m_LifeTime)
{
GameObject.Destroy(this.gameObject);
}
}
}
|