//void FixedUpdate(){ //WrapMode emulator /* * if (currentAnimationData == null || currentAnimationData.clip == null) return; * var normalizedTime = GetNormalizedTime(); * Debug.Log("normalizedTime" + normalizedTime + "Mathf.FloorToInt(normalizedTime)" + Mathf.FloorToInt(normalizedTime)); * var timesPlayed = Mathf.FloorToInt(normalizedTime); * if (currentAnimationData.timesPlayed > timesPlayed) * { * currentAnimationData.timesPlayed = timesPlayed; * } * else if (currentAnimationData.timesPlayed < timesPlayed) * { * if (currentAnimationData.clip.wrapMode == WrapMode.Loop || currentAnimationData.clip.wrapMode == WrapMode.PingPong) * { * if (MecanimControl.OnAnimationLoop != null) MecanimControl.OnAnimationLoop(currentAnimationData); * currentAnimationData.timesPlayed++; * * var position = normalizedTime - timesPlayed; * if (currentAnimationData.clip.wrapMode == WrapMode.Loop) * { * //SetCurrentClipPosition(position); * currentAnimationData.secondsPlayed = normalizedTime * currentAnimationData.length; * } * * if (currentAnimationData.clip.wrapMode == WrapMode.PingPong) * { * SetSpeed(currentAnimationData.clipName, -currentAnimationData.speed); * SetCurrentClipPosition(position); * } * * } * else if (currentAnimationData.timesPlayed == 0) * { * if (MecanimControl.OnAnimationEnd != null) MecanimControl.OnAnimationEnd(currentAnimationData); * currentAnimationData.timesPlayed = 1; * * if (currentAnimationData.clip.wrapMode == WrapMode.Once && alwaysPlay) * { * Play(defaultAnimation, currentMirror); * } * else if (!alwaysPlay) * { * animator.speed = 0; * } * } * } * else * { * //currentAnimationData.secondsPlayed += Time.deltaTime * animator.speed * Time.timeScale; * currentAnimationData.secondsPlayed += (Time.fixedDeltaTime * animator.speed); * //if (currentAnimationData.secondsPlayed > currentAnimationData.length) * // currentAnimationData.secondsPlayed = currentAnimationData.length; * } * */ //} //void OnGUI() //{ // //Toggle debug mode to see the live data in action // if (debugMode) // { // GUI.Box(new Rect(Screen.width - 340, 40, 340, 400), "Animation Data"); // GUI.BeginGroup(new Rect(Screen.width - 330, 60, 400, 400)); // { // AnimatorClipInfo[] animationInfoArray = animator.GetCurrentAnimatorClipInfo(0); // foreach (AnimatorClipInfo animationInfo in animationInfoArray) // { // AnimatorStateInfo animatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); // GUILayout.Label(animationInfo.clip.name); // GUILayout.Label("-Wrap Mode: " + animationInfo.clip.wrapMode); // GUILayout.Label("-Is Playing: " + IsPlaying(animationInfo.clip.name)); // GUILayout.Label("-Blend Weight: " + animationInfo.weight); // GUILayout.Label("-Normalized Time: " + animatorStateInfo.normalizedTime); // GUILayout.Label("-Length: " + animationInfo.clip.length); // GUILayout.Label("----"); // } // GUILayout.Label("--Current Animation Data--"); // GUILayout.Label("-Current Clip Name: " + currentAnimationData.clipName); // GUILayout.Label("-Current Speed: " + GetSpeed().ToString()); // GUILayout.Label("-Times Played: " + currentAnimationData.timesPlayed); // GUILayout.Label("-Seconds Played: " + currentAnimationData.secondsPlayed); // GUILayout.Label("-Emul. Normalized: " + (currentAnimationData.secondsPlayed / currentAnimationData.length)); // GUILayout.Label("-Lengh: " + currentAnimationData.length); // GUILayout.Label("-GetNormalizedTime(): " + GetNormalizedTime()); // } // GUI.EndGroup(); // } //} public void ClearClips() { foreach (var name in animations.Keys) { Game.AnimationClipPool.RemoveClipRef(name); } animations.Clear(); defaultAnimationData.Reset(); }