AddChild() public method

public AddChild ( MovableObject ob ) : void
ob MovableObject
return void
Ejemplo n.º 1
0
        public void MoveTo(ContainerObject dst, IntVector3 dstLoc)
        {
            var src    = this.Container;
            var srcLoc = this.Location;

            if (src != dst)
            {
                if (src != null)
                {
                    src.RemoveChild(this);
                }

                this.Container = dst;
            }

            if (srcLoc != dstLoc)
            {
                this.Location = dstLoc;
                if (dst != null && src == dst)
                {
                    dst.MoveChild(this, srcLoc, dstLoc);
                }
            }

            if (src != dst)
            {
                if (dst != null)
                {
                    dst.AddChild(this);
                }
            }

            if (src != dst || srcLoc != dstLoc)
            {
                if (ObjectMoved != null)
                {
                    ObjectMoved(this, this.Container, this.Location);
                }
            }
        }
Ejemplo n.º 2
0
        public void MoveTo(ContainerObject dst, IntPoint3 dstLoc)
        {
            var src = this.Parent;
            var srcLoc = this.Location;

            if (src != dst)
            {
                if (src != null)
                    src.RemoveChild(this);

                this.Parent = dst;
            }

            if (srcLoc != dstLoc)
            {
                this.Location = dstLoc;
                if (dst != null && src == dst)
                    dst.MoveChild(this, srcLoc, dstLoc);
            }

            if (src != dst)
            {
                if (dst != null)
                    dst.AddChild(this);
            }

            if (src != dst || srcLoc != dstLoc)
                if (ObjectMoved != null)
                    ObjectMoved(this, this.Parent, this.Location);
        }