27 lines
585 B (Stored with Git LFS)
C#
27 lines
585 B (Stored with Git LFS)
C#
using UnityEngine;
|
|
|
|
public class SpawnEffect : MonoBehaviour
|
|
{
|
|
private Animator animator;
|
|
|
|
private void Start()
|
|
{
|
|
animator = gameObject.AddComponent<Animator>();
|
|
animator.runtimeAnimatorController = SLResources.GetAnimatorController("SpawnEffect");
|
|
animator.Play("Animation");
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1.0f) return;
|
|
|
|
Destroy(animator);
|
|
Destroy(this);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
Destroy(animator);
|
|
Destroy(this);
|
|
}
|
|
} |