Пример #1
0
        public static Point2D AdjecentTile(World.Tile curtile, int swingloc, World.Map curmap)
        {
            if (swingloc == -1)
            {
                swingloc = 7;
            }
            if (swingloc == 8)
            {
                swingloc = 0;
            }

            if (swingloc == 0 && curtile.Y - 1 >= 0)
            {
                return(new Point2D(curtile.X, curtile.Y - 1));
            }
            if (swingloc == 1 && curtile.X + 1 < curmap.sizeX && curtile.Y - 1 >= 0)
            {
                return(new Point2D(curtile.X + 1, curtile.Y - 1));
            }
            if (swingloc == 2)
            {
                return(new Point2D(curtile.X + 1, curtile.Y));
            }
            if (swingloc == 3)
            {
                return(new Point2D(curtile.X + 1, curtile.Y + 1));
            }
            if (swingloc == 4)
            {
                return(new Point2D(curtile.X, curtile.Y + 1));
            }
            if (swingloc == 5)
            {
                return(new Point2D(curtile.X - 1, curtile.Y + 1));
            }
            if (swingloc == 6)
            {
                return(new Point2D(curtile.X - 1, curtile.Y));
            }
            if (swingloc == 7)
            {
                return(new Point2D(curtile.X - 1, curtile.Y - 1));
            }

            return(null);
        }
Пример #2
0
 public NavMesh(World.Map map)
 {
     Tiles = map.CopyTiles;
 }