// ============================================================================================================ public void Start() { ani = GetComponent<Animation>(); chara = GetComponent<Chara2_Base>(); // init idle ani if (string.IsNullOrEmpty(idleClip)) idleClip = null; // set to null for faster if() checks if (idleClip != null) { ani[idleClip].speed = idlePlaySpeed; ani[idleClip].wrapMode = WrapMode.Loop; ani.Play(idleClip); } // sorted so that lower speedDetect is checked first movementAnimations.Sort((a, b) => { return a.maxSpeedDetect.CompareTo(b.maxSpeedDetect); }); // init movement anis for (int i = 0; i < movementAnimations.Count; i++) { if (!string.IsNullOrEmpty(movementAnimations[i].clipName)) { ani[movementAnimations[i].clipName].speed = movementAnimations[i].playSpeed; ani[movementAnimations[i].clipName].wrapMode = WrapMode.Loop; } else movementAnimations[i] = null; // set to null for faster if() checks } // init antics _anticsOn = (UniRPGGlobal.Instance.state != UniRPGGlobal.State.InMainMenu); anticsTimer = anticsWaitTimeMin; }
// ============================================================================================================ protected void Start() { ani = GetComponent<Animator>(); chara = GetComponent<Chara2_Base>(); speedHash = Animator.StringToHash(speedParam); // init antics _anticsOn = (UniRPGGlobal.Instance.state != UniRPGGlobal.State.InMainMenu); anticsTimer = anticsWaitTimeMin; anticGUIDs = new int[anticsAnimations.Length]; for (int i = 0; i < anticsAnimations.Length; i++) { if (!string.IsNullOrEmpty(anticsAnimations[i])) anticGUIDs[i] = Animator.StringToHash(anticsAnimations[i]); else anticGUIDs[i] = 0; } }