Exemple #1
0
        public static void AssignParent(Transform child, Transform parent, EntityAdmin admin, bool ignoreExceptions = false)
        {
            var tempParent = parent;

            while (tempParent != null)
            {
                if (tempParent == child)
                {
                    if (ignoreExceptions)
                    {
                        return;
                    }
                    throw new Exception("Can't assign child to parent because child is already a parent of child!");
                }
                tempParent = tempParent.Parent;
            }

            if (child.Parent != null)
            {
                child.Parent.Children.Remove(child);
            }

            if (parent != null)
            {
                if (parent.Children.Contains(child))
                {
                    Console.WriteLine("WARNING: assigning a child Transform when it is already a child!");
                }
                else
                {
                    parent.Children.Add(child);
                }
            }

            child.Parent = parent;
        }
Exemple #2
0
 public virtual void Tick(EntityAdmin admin)
 {
 }