private void OnComplete(Spine.TrackEntry entry) { string name = entry.Animation.Name; if (!animList.ContainsKey(name)) { return; } SpineAnimClip clip = animList[name]; if (clip.loopType == SpineAnimClip.LoopType.NOTLOOP_REPLACE) { // if this animation is not looping // pick another animation in the same group // 15: clear all except 4 string[] names = name.Split('_'); SetRandomAnimation(names[0], CLEAR_NOT_FACIAL, name); } }
// Use this for initialization void Start() { anim = GetComponentInChildren <SkeletonAnimation>(); anim.state.Complete += OnComplete; TextAsset textAsset = Resources.Load <TextAsset>("Rosters/SpineAnimationList"); string texts = textAsset.text; string[] lines = texts.Split('\n', '\r'); for (int i = 1; i < lines.Length; i++) { string[] row = lines[i].Split(splitter); if (row[0] == "1") { SpineAnimClip clip = new SpineAnimClip(); string name = row[1]; int.TryParse(row[2], out clip.track); switch (row[3]) { case "LOOP": clip.loopType = SpineAnimClip.LoopType.LOOP; break; case "NOTLOOP_REPLACE": clip.loopType = SpineAnimClip.LoopType.NOTLOOP_REPLACE; break; case "NOTLOOP_KEEP": clip.loopType = SpineAnimClip.LoopType.NOTLOOP_KEEP; break; } float.TryParse(row[4], out clip.mixTime); animList.Add(name, clip); } } SetAnimation("eye_blink"); }