예제 #1
0
파일: Figure.cs 프로젝트: Jhoonny/Snake
 internal bool IsHit(Figure figure)
 {
     foreach (var p in pList) {
         if(figure.IsHit(p)) return true;
     }
     return false;
 }
예제 #2
0
 public bool IsHit(Figure figure)
 {
     foreach (var p in pointsList)
     {
         if (figure.IsHit(p))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #3
0
 internal bool IsHit(Figure figure)
 {
     foreach (var p in dots)
     {
         if (figure.IsHit(p))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #4
0
 public bool IsHit(Figure figure)
 {
     foreach (Point p in pline)
     {
         if (figure.IsHit(p))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #5
0
 public bool IsHit(Figure figure)
 {
     foreach (Point point in pList)
     {
         if (figure.IsHit(point))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #6
0
 internal bool IsHit(Figure figure)
 {
     foreach (Point p in pList)
     {
         if (figure.IsHit(p))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #7
0
 internal bool IsHit(Figure figure)
 {
     foreach (var point in pointList)
     {
         if (figure.IsHit(point))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #8
0
 /* Функция возвращает столкнулась ли змейка со стенами */
 internal bool IsHit(Figure figure)
 {
     foreach (var fig in pList)
     {
         if (figure.IsHit(fig))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #9
0
        /// <summary>
        ///     Проверка столкновения
        /// </summary>
        /// <param name="figure">Фигура</param>
        /// <returns>True - столкновение было, False - столкновения не было</returns>
        public bool IsHit(Figure figure)
        {
            foreach (var linePoint in LinePoints)
            {
                if (figure.IsHit(linePoint))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #10
0
 public Point CreateFood(Figure figure)
 {
     while (true)
     {
         int   x = random.Next(2, mapWidth - 2);
         int   y = random.Next(2, mapHeight - 2);
         Point p = new Point(x, y, symb);
         if (!figure.IsHit(p))
         {
             return(p);
         }
     }
 }
예제 #11
0
        public Point CreateFood(Figure snake)
        {
            Point p = new Point(0, 0, sym);

            do
            {
                Random random = new Random();
                p.x = random.Next(2, mapWidht - 2);
                p.y = random.Next(2, mapHeight - 2);
            } while (snake.IsHit(p));

            return(p);
        }
예제 #12
0
 internal virtual bool IsHit(Figure figure)
 {
     if (_PointList != null)
     {
         foreach (Point point in this._PointList)
         {
             if (figure.IsHit(point))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #13
0
        public Point Create(Figure figure)
        {
            int   x    = random.Next(3, this.MapWidth - 3);
            int   y    = random.Next(3, this.MapHeight - 3);
            Point food = new Point(x, y, this.Symbol, ConsoleColor.Yellow);

            if (figure.IsHit(food))
            {
                food.Clear();
                Create(figure);
            }

            return(food);
        }
예제 #14
0
        public Point CreateFood(Figure figure)
        {
            while (true)
            {
                int x = random.Next(2, mapWidth - 2);
                int y = random.Next(2, mapHeight - 2);
                Console.SetCursorPosition(121, 3);
                Console.WriteLine($"Food X = {x}, Y = {y}");

                Point newPoint = new Point(x, y, food);
                if (!figure.IsHit(newPoint) && newPoint != prevPoint)
                {
                    prevPoint = newPoint;
                    return(newPoint);
                }
                else
                {
                    continue;
                }
            }
        }
예제 #15
0
 public bool IsHit(Figure figure)
 {
     return(_points.Any(point => figure.IsHit(point)));
 }
예제 #16
0
파일: Walls.cs 프로젝트: markyha2012/Snake
 public static bool IsHit(Walls w, Point p) => w.walls.Any(f => Figure.IsHit(f, p));
예제 #17
0
파일: Walls.cs 프로젝트: markyha2012/Snake
 public static bool IsHit(Walls w, Figure f) => w.walls.Any(f1 => Figure.IsHit(f1, f));