示例#1
0
        /// <summary>
        /// Finds or creates the RoutineIdentity for the given GameObject.
        /// </summary>
        static public RoutineIdentity Require(GameObject inGameObject)
        {
            RoutineIdentity obj = Find(inGameObject);

            if (obj == null)
            {
                obj = inGameObject.AddComponent <RoutineIdentity>();
            }
            return(obj);
        }
示例#2
0
        /// <summary>
        /// Finds or creates the RoutineIdentity for the given behaviour.
        /// </summary>
        static public RoutineIdentity Require(MonoBehaviour inBehaviour)
        {
            RoutineIdentity obj = Find(inBehaviour.gameObject);

            if (obj == null)
            {
                obj = inBehaviour.gameObject.AddComponent <RoutineIdentity>();
            }
            return(obj);
        }
示例#3
0
        static private void RegisterIdentity(RoutineIdentity inIdentity)
        {
            int key = inIdentity.gameObject.GetInstanceID();

            if (s_IdentityRegistry.ContainsKey(key))
            {
                return;
            }
            s_IdentityRegistry.Add(key, inIdentity);
        }
示例#4
0
        /// <summary>
        /// Calculates the time scale for the given object.
        /// </summary>
        static public float CalculateTimeScale(RoutineIdentity inIdentity)
        {
            Manager m = Manager.Get();

            if (m != null)
            {
                if (inIdentity != null)
                {
                    return(m.GetTimescale(inIdentity.Group) * m.TimeScale * inIdentity.TimeScale);
                }
                return(m.TimeScale);
            }
            return(1.0f);
        }
示例#5
0
        /// <summary>
        /// Calculates the time scale for the given object.
        /// </summary>
        static public float CalculateTimeScale(GameObject inObject)
        {
            Manager m = Manager.Get();

            if (m != null)
            {
                RoutineIdentity identity = RoutineIdentity.Find(inObject);
                if (identity != null)
                {
                    return(m.GetTimescale(identity.Group) * m.TimeScale * identity.TimeScale);
                }
                return(m.TimeScale);
            }
            return(1.0f);
        }
示例#6
0
        static private void UnregisterIdentity(RoutineIdentity inIdentity)
        {
            int key = inIdentity.gameObject.GetInstanceID();

            s_IdentityRegistry.Remove(key);
        }
示例#7
0
 public TweenData_RoutineIdentity_TimeScale(RoutineIdentity inIdentity, float inTarget)
 {
     m_Identity = inIdentity;
     m_Target   = inTarget;
 }
示例#8
0
 /// <summary>
 /// Changes the TimeScale of the RoutineIdentity on this GameObject.
 /// </summary>
 static public Tween TimeScaleTo(this GameObject inGameObject, float inTarget, TweenSettings inSettings)
 {
     return(Tween.Create(new TweenData_RoutineIdentity_TimeScale(RoutineIdentity.Require(inGameObject), inTarget), inSettings));
 }
示例#9
0
 /// <summary>
 /// Changes the TimeScale of the RoutineIdentity.
 /// </summary>
 static public Tween TimeScaleTo(this RoutineIdentity inIdentity, float inTarget, TweenSettings inSettings)
 {
     return(Tween.Create(new TweenData_RoutineIdentity_TimeScale(inIdentity, inTarget), inSettings));
 }