Beispiel #1
0
        public override void OnMapChange()
        {
            base.OnMapChange();

            if (Shadow != null && !Shadow.Deleted)
            {
                Shadow.MoveToWorld(new Point3D(X, Y, Z - 3), Map);
            }
        }
Beispiel #2
0
        public void Teleport(int xOffset, int yOffset, int zOffset, Map map)
        {
            for (int i = 0; i < IncludedEntities.Count; i++)
            {
                if (Contains(IncludedEntities[i].Location))
                {
                    Point3D loc = new Point3D(IncludedEntities[i].X + xOffset, IncludedEntities[i].Y + yOffset, IncludedEntities[i].Z + zOffset);

                    if (IncludedEntities[i] is Item && IncludedEntities[i].Z == (this.Z + 1))
                    {
                        ((Item)IncludedEntities[i]).MoveToWorld(loc, map);
                    }
                    else if (IncludedEntities[i] is Mobile && IncludedEntities[i].Z == (this.Z + 1))
                    {
                        ((Mobile)IncludedEntities[i]).MoveToWorld(loc, map);
                    }
                }
            }

            if (Owner != null && Contains(Owner) && Owner.Z == (this.Z + 1))
            {
                Owner.MoveToWorld(new Point3D(Owner.X + xOffset, Owner.Y + yOffset, Owner.Z + zOffset), Owner.Map);
            }

            Point3D locationPoint = new Point3D(X + xOffset, Y + yOffset, Z + zOffset);

            Location = locationPoint;
            Map      = map;

            if (Shadow != null && !Shadow.Deleted)
            {
                object top = Map.GetTopSurface(locationPoint);
                int    z   = Map.GetAverageZ(locationPoint.X, locationPoint.Y);

                if (top is LandTile)
                {
                    z = ((LandTile)top).Z + ((LandTile)top).Height;
                }
                else if (top is StaticTile)
                {
                    z = ((StaticTile)top).Z + ((StaticTile)top).Height;
                }
                else if (top is Item)
                {
                    z = ((Item)top).GetWorldTop().Z;
                }

                Shadow.MoveToWorld(new Point3D(locationPoint, z), map);
            }
        }