Inheritance: BaseObject, IContainerObject
Exemplo n.º 1
0
        // Move to a location in a new container
        void MoveToLow(ContainerObject dst, IntVector3 dstLoc)
        {
            Debug.Assert(this.IsInitialized);
            Debug.Assert(!this.IsDestructed);
            Debug.Assert(this.Container != dst);

            var src = this.Container;
            var srcLoc = this.Location;

            this.OnParentChanging();

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

            this.Container = dst;
            this.Location = dstLoc;

            if (dst != null)
                dst.AddChild(this);

            this.OnParentChanged(src, dst);

            this.World.AddChange(new ObjectMoveChange(this, src, srcLoc, dst, dstLoc));
        }
Exemplo n.º 2
0
        public ObjectMoveChange(MovableObject mover, ContainerObject sourceEnv, IntPoint3 sourceLocation,
			ContainerObject destinationEnv, IntPoint3 destinationLocation)
            : base(mover)
        {
            this.Source = sourceEnv;
            this.SourceLocation = sourceLocation;
            this.Destination = destinationEnv;
            this.DestinationLocation = destinationLocation;
        }
Exemplo n.º 3
0
        public void MoveToMustSucceed(ContainerObject dst, IntVector3 dstLoc = new IntVector3())
        {
            bool ok = MoveTo(dst, dstLoc);

            if (!ok)
                throw new Exception();
        }
Exemplo n.º 4
0
 protected virtual void OnParentChanged(ContainerObject src, ContainerObject dst)
 {
 }
Exemplo n.º 5
0
        public bool MoveTo(ContainerObject dst, IntVector3 dstLoc = new IntVector3())
        {
            Debug.Assert(this.World.IsWritable);

            if (!OkToMove())
                return false;

            if (this.Container == dst && this.Location == dstLoc)
                return true;

            if (dst != null && !dst.OkToAddChild(this, dstLoc))
                return false;

            if (dst != this.Container)
                MoveToLow(dst, dstLoc);
            else
                MoveToLow(dstLoc);

            return true;
        }
Exemplo n.º 6
0
        public void MoveToMustSucceed(ContainerObject container)
        {
            bool ok = MoveTo(container);

            if (!ok)
                throw new Exception();
        }
Exemplo n.º 7
0
        public bool MoveTo(ContainerObject container)
        {
            if (this.Container == container)
                return true;

            return MoveTo(container, new IntVector3());
        }
Exemplo n.º 8
0
        protected override void OnParentChanged(ContainerObject src, ContainerObject dst)
        {
            m_losMapVersion = 0;

            if (this.ParentChanged != null)
                this.ParentChanged(this, src, dst);
        }
Exemplo n.º 9
0
        void OnControllableParentChanged(LivingObject living, ContainerObject _src, ContainerObject _dst)
        {
            var src = _src as EnvironmentObject;

            if (src != null)
            {
                var tracker = GetVisionTrackerInternal(src);
                tracker.RemoveLiving(living);
            }

            var dst = _dst as EnvironmentObject;

            if (dst != null)
            {
                var tracker = GetVisionTrackerInternal(src);
                tracker.AddLiving(living);
            }
        }
Exemplo n.º 10
0
        public bool MoveTo(ContainerObject parent)
        {
            if (this.Parent == parent)
                return true;

            return MoveTo(parent, new IntPoint3());
        }
Exemplo n.º 11
0
 protected virtual void OnParentChanged(ContainerObject src, ContainerObject dst)
 {
 }