public IEnumerator State_Time_SetTime_DoesntStartState([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type) { IAnimation animation = ComparativeTestFixture.Instantiate(type); var clip = Resources.Load <AnimationClip>("LinearX"); var clipInstance = Object.Instantiate <AnimationClip>(clip); clipInstance.legacy = animation.usesLegacy; animation.AddClip(clipInstance, "ValidName"); IAnimationState state = animation.GetState("ValidName"); animation.Play(state.name); state.time = 2.0f; state.time = 0.2f; yield return(null); Assert.IsTrue(state.enabled, "State should be disabled"); Assert.IsTrue(animation.IsPlaying(state.name), "State should be disabled"); Assert.IsTrue(animation.isPlaying, "State should be disabled"); }
public IEnumerator NegativeSpeed_Does_Trigger_Crossfade([ValueSource(typeof(ComparativeTestFixture), "Sources")] System.Type type) { IAnimation animation = ComparativeTestFixture.Instantiate(type); var clip = Resources.Load <AnimationClip>("LinearX"); var clipInstance = Object.Instantiate <AnimationClip>(clip); clipInstance.legacy = animation.usesLegacy; animation.AddClip(clipInstance, "PlayBackwards"); animation.AddClip(clipInstance, "Crossfade"); IAnimationState state = animation.GetState("PlayBackwards"); state.enabled = true; state.time = 0.5f; state.speed = -1f; animation.PlayQueued("Crossfade", QueueMode.CompleteOthers); yield return(new WaitForSeconds(0.5f)); Assert.IsTrue(state.enabled); Assert.IsTrue(animation.IsPlaying("Crossfade")); }