using System.Collections; using System.Collections.Generic; using UnityEngine; using WS; public class LineAni : MonoBehaviour { [HideInInspector] public bool ToEnd; public Animator redLineAni; public Animator blackLineAni; private string redLineAniName = "RecycleRed"; private string blackLineAniName = "RecycleBlack"; private void OnEnable() { if (redLineAni == null || blackLineAni == null) { return; } RecycleLine(); } private void Update() { if (ToEnd) { redLineAni.Play(redLineAniName, -1, 1f); blackLineAni.Play(blackLineAniName, -1, 1f); } } private void OnDisable() { redLineAni.Play(redLineAniName, -1, 0f); redLineAni.speed = 0f; blackLineAni.Play(blackLineAniName, -1, 0f); blackLineAni.speed = 0f; } private void RecycleLine() { redLineAni.Play(redLineAniName); redLineAni.speed = 1; blackLineAni.Play(blackLineAniName); blackLineAni.speed = 1; } }