123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using UnityEngine;
- namespace Animancer
- {
-
-
-
-
-
-
- public interface ITransitionDetailed : ITransition
- {
-
-
- bool IsValid { get; }
-
- bool IsLooping { get; }
-
-
- float NormalizedStartTime { get; set; }
-
-
- float MaximumDuration { get; }
-
- float Speed { get; set; }
-
- }
-
- public static partial class AnimancerUtilities
- {
-
-
- public static bool IsValid(this ITransition transition)
- {
- if (transition == null)
- return false;
- if (TryGetWrappedObject(transition, out ITransitionDetailed detailed))
- return detailed.IsValid;
- return true;
- }
-
-
-
- public static bool TryGetIsLooping(object motionOrTransition, out bool isLooping)
- {
- if (motionOrTransition is Motion motion)
- {
- isLooping = motion.isLooping;
- return true;
- }
- else if (TryGetWrappedObject(motionOrTransition, out ITransitionDetailed transition))
- {
- isLooping = transition.IsLooping;
- return true;
- }
- else
- {
- isLooping = false;
- return false;
- }
- }
-
-
-
- public static bool TryGetLength(object motionOrTransition, out float length)
- {
- if (motionOrTransition is AnimationClip clip)
- {
- length = clip.length;
- return true;
- }
- else if (TryGetWrappedObject(motionOrTransition, out ITransitionDetailed transition))
- {
- length = transition.MaximumDuration;
- return true;
- }
- else
- {
- length = 0;
- return false;
- }
- }
-
- }
- }
|