Esempio n. 1
0
 public void ClearMap()
 {
     for (int x = 0; x < TileLayer.Width; x++)
     {
         for (int y = 0; y < TileLayer.Height; y++)
         {
             if (TileLayer.GetCellMovability(x, y))
             {
                 distanceMap[x, y] = float.MaxValue;
             }
             else
             {
                 distanceMap[x, y] = -1.0f;
             }
         }
     }
 }
Esempio n. 2
0
        // Return true on collision
        public static bool RayTest(Vector2 startPos, Vector2 endPos)
        {
            for (int x = 0; x < TileLayer.Width; x++)
            {
                for (int y = 0; y < TileLayer.Height; y++)
                {
                    if (!TileLayer.GetCellMovability(x, y))
                    {
                        if (SegmentIntersectRectangle(new Vector2(x, y), new Vector2(x + 1, y + 1), startPos, endPos))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }