/// <summary>
        /// </summary>
        /// <param name="c">
        /// </param>
        /// <param name="playfieldId">
        /// </param>
        /// <returns>
        /// </returns>
        public static WallCollisionResult CheckCollision(Coordinate c, int playfieldId)
        {
            // get the coords local
            float x = c.x;
            float z = c.z;

            List <PlayfieldWalls> walls = PlayfieldLoader.PFData[playfieldId].Walls;

            foreach (PlayfieldWalls pfws in walls)
            {
                int wallsInPlayfield = pfws.Walls.Count;
                for (int i = 0; i < wallsInPlayfield; i++)
                {
                    if (MinimalDistance(pfws.Walls[i], pfws.Walls[(i + 1) % wallsInPlayfield], x, z)
                        < WallCollisionThreshold)
                    {
                        WallCollisionResult wcr = new WallCollisionResult();
                        wcr.FirstWall  = pfws.Walls[i];
                        wcr.SecondWall = pfws.Walls[(i + 1) % wallsInPlayfield];
                        wcr.Factor     = Distance(wcr.FirstWall, x, z)
                                         / Distance(wcr.FirstWall, wcr.SecondWall.X, wcr.SecondWall.Z);
                        return(wcr);
                    }
                }
            }

            return(null);
        }
        /// <summary>
        /// </summary>
        /// <param name="c">
        /// </param>
        /// <param name="playfieldId">
        /// </param>
        /// <returns>
        /// </returns>
        public static WallCollisionResult CheckCollision(Coordinate c, int playfieldId)
        {
            // get the coords local
            float x = c.x;
            float z = c.z;

            List<PlayfieldWalls> walls = PlayfieldLoader.PFData[playfieldId].Walls;
            foreach (PlayfieldWalls pfws in walls)
            {
                int wallsInPlayfield = pfws.Walls.Count;
                for (int i = 0; i < wallsInPlayfield; i++)
                {
                    if (MinimalDistance(pfws.Walls[i], pfws.Walls[(i + 1) % wallsInPlayfield], x, z)
                        < WallCollisionThreshold)
                    {
                        WallCollisionResult wcr = new WallCollisionResult();
                        wcr.FirstWall = pfws.Walls[i];
                        wcr.SecondWall = pfws.Walls[(i + 1) % wallsInPlayfield];
                        wcr.Factor = Distance(wcr.FirstWall, x, z)
                                     / Distance(wcr.FirstWall, wcr.SecondWall.X, wcr.SecondWall.Z);
                        return wcr;
                    }
                }
            }

            return null;
        }