public static Point3D GetSurfaceTop(this IPoint3D p, Map map, bool items = true) { if (map == null || map == Map.Internal) { return p.ToPoint3D(); } Point3D point = Point3D.Zero; if (p is Item) { point = p.Clone3D(0, 0, ((Item)p).ItemData.Height); } else if (p is Mobile) { point = p.Clone3D(0, 0, 20); } /*else { point = p.Clone3D(0, 0, 5); }*/ object o = map.GetTopSurface(point); if (o != null && o != p) { if (o is LandTile) { point.Z = ((LandTile)o).Z + ((LandTile)o).Height + 1; } else if (o is StaticTile) { point.Z = ((StaticTile)o).Z + ((StaticTile)o).Height + 1; } else if (o is Item && items) { point = ((Item)o).GetSurfaceTop(); } } return point; }
public static Point3D GetWorldTop(this IPoint3D p, Map map) { if (map == null || map == Map.Internal) { return p.ToPoint3D(); } Point3D point; if (p is Item) { point = p.Clone3D(0, 0, ((Item)p).ItemData.Height); } else if (p is Mobile) { point = p.Clone3D(0, 0, 20); } else if (p is Entity) { point = p.Clone3D(0, 0, 5); } else { point = p.ToPoint3D(); } int z, a, t; GetAverageZ(point, map, out z, out a, out t); point.Z = t; return point; }
public static Point3D Lerp3D(this IPoint3D start, int x, int y, int z, double percent) { return start.Clone3D((int)((x - start.X) * percent), (int)((y - start.Y) * percent), (int)((z - start.Z) * percent)); }