Beispiel #1
0
        /// <summary>This method will begin all transition entries.</summary>
        public void Begin()
        {
            Validate(false);

            if (entries != null)
            {
                LeanTransition.CurrentAliases.Clear();

                foreach (var entry in entries)
                {
                    foreach (var alias in entry.Aliases)
                    {
                        LeanTransition.AddAlias(alias.Key, alias.Obj);
                    }

                    LeanTransition.BeginAllTransitions(entry.Root, entry.Speed);
                }
            }
        }
        public void BeginAllTransitions()
        {
            LeanTransition.CurrentAliases.Clear();

            LeanTransition.BeginAllTransitions(transform);
        }
Beispiel #3
0
 /// <summary>This will insert all transitions inside the specified GameObject, as if they were added manually.</summary>
 public static GameObject JoinInsertTransition(this UnityEngine.GameObject target, Transform root, float speed = 1.0f)
 {
     LeanTransition.CurrentQueue = LeanTransition.CurrentHead; LeanTransition.InsertTransitions(root, speed); LeanTransition.CurrentQueue = LeanTransition.CurrentHead; return(target);
 }
Beispiel #4
0
 /// <summary>This will insert all transitions inside the specified GameObject, as if they were added manually.</summary>
 public static T JoinInsertTransition <T>(this T target, Transform root, float speed = 1.0f)
     where T : Component
 {
     LeanTransition.CurrentQueue = LeanTransition.CurrentHead; LeanTransition.InsertTransitions(root, speed); LeanTransition.CurrentQueue = LeanTransition.CurrentHead; return(target);
 }
 /// <summary>This will insert all transitions inside the specified GameObject, as if they were added manually.</summary>
 public static GameObject InsertTransition(this GameObject target, Transform root)
 {
     LeanTransition.InsertTransitions(root); return(target);
 }
Beispiel #6
0
        public void Validate(bool validateEntries)
        {
            if (roots != null && roots.Count > 0)
            {
                Entries.Clear();

                foreach (var root in roots)
                {
                    if (root != null)
                    {
                        entries.Add(new Entry()
                        {
                            Root = root, Speed = speed > 0.0f ? speed : -1.0f
                        });
                    }
                }

                roots.Clear();
            }

            if (Entries.Count == 0)
            {
                entries.Add(new Entry());
            }

            if (aliases != null && aliases.Count > 0 && targets != null && targets.Count > 0)
            {
                var min = System.Math.Min(aliases.Count, targets.Count);

                for (var i = 0; i < min; i++)
                {
                    foreach (var entry in Entries)
                    {
                        entry.AddAlias(aliases[i], targets[i]);
                    }
                }

                aliases.Clear();
                targets.Clear();
            }

            if (validateEntries == true)
            {
                foreach (var entry in Entries)
                {
                    if (entry != null)
                    {
                        var pairs = LeanTransition.FindAllAliasTypePairs(entry.Root);

                        // Move entry.Aliases into dictionary
                        foreach (var alias in entry.Aliases)
                        {
                            tempAliases.Add(alias.Key, alias);
                        }

                        entry.Aliases.Clear();

                        // Rebuild entry.Aliases from dictionaries
                        foreach (var pair in pairs)
                        {
                            Alias alias;

                            // Use existing by set type again (it's non-serialized, so it must be set again)
                            if (tempAliases.TryGetValue(pair.Key, out alias) == true)
                            {
                                alias.Type = pair.Value;

                                entry.Aliases.Add(alias);
                            }
                            // Use new
                            else
                            {
                                entry.Aliases.Add(new Alias()
                                {
                                    Key = pair.Key, Type = pair.Value
                                });
                            }
                        }

                        // Discard remaining
                        tempAliases.Clear();
                    }
                }
            }
        }
 /// <summary>This will insert all transitions inside the specified GameObject, as if they were added manually.</summary>
 public static T InsertTransition <T>(this T target, Transform root)
     where T : Component
 {
     LeanTransition.InsertTransitions(root); return(target);
 }
 /// <summary>This will insert all transitions inside the specified GameObject, as if they were added manually.</summary>
 public static GameObject JoinInsertTransition(this GameObject target, Transform root, float speed = 1.0f)
 {
     LeanTransition.CurrentQueue = LeanTransition.PreviousState; LeanTransition.InsertTransitions(root, speed); LeanTransition.CurrentQueue = LeanTransition.PreviousState; return(target);
 }
 /// <summary>This will insert all transitions inside the specified GameObject, as if they were added manually.</summary>
 public static T JoinInsertTransition <T>(this T target, GameObject root, float speed = 1.0f)
     where T : Component
 {
     LeanTransition.CurrentQueue = LeanTransition.PreviousState; LeanTransition.InsertTransitions(root, speed); LeanTransition.CurrentQueue = LeanTransition.PreviousState; return(target);
 }
Beispiel #10
0
 /// <summary>This will insert all transitions inside the specified GameObject, as if they were added manually.</summary>
 public static GameObject InsertTransition(this UnityEngine.GameObject target, UnityEngine.GameObject root)
 {
     LeanTransition.InsertTransitions(root); return(target);
 }
Beispiel #11
0
 /// <summary>This will insert all transitions inside the specified GameObject, as if they were added manually.</summary>
 public static T InsertTransition <T>(this T target, UnityEngine.GameObject root)
     where T : Component
 {
     LeanTransition.InsertTransitions(root); return(target);
 }