Example #1
0
        public Snake(Point tail, int lenght, Dirrection direction)

        {
            plist = new List <Point>();
            for (int i = 0; i < lenght; i++)
            {
                Point p = new Point(tail);
                p.Move(i, direction);
                plist.Add(p);
            }
        }
Example #2
0
 public void Move(int offset, Dirrection direction)
 {
     if (direction == Dirrection.RIGNT)
     {
         x = x + offset;
     }
     else if (direction == Dirrection.LEFT)
     {
         x = x - offset;
     }
     else
     {
     }
 }
Example #3
0
    public Point GetWayPoint(Point from, Dirrection dir)
    {
        Point res = null;

        switch (dir)
        {
        case Dirrection.Left:
            for (sbyte i = from.x; i >= 0 && !arr[i, from.y]; i--)
            {
                res = new Point(i, from.y);
            }
            break;

        case Dirrection.Up:
            for (sbyte i = from.y; i >= 0 && !arr[from.x, i]; i--)
            {
                res = new Point(from.x, i);
            }
            break;

        case Dirrection.Right:
            for (sbyte i = from.x; i < arr.GetLength(0) && !arr[i, from.y]; i++)
            {
                res = new Point(i, from.y);
            }
            break;

        case Dirrection.Down:
            for (sbyte i = from.y; i < arr.GetLength(1) && !arr[from.x, i]; i++)
            {
                res = new Point(from.x, i);
            }
            break;
        }
        return(res);
    }
Example #4
0
 public async Task SendStep(Dirrection down)
 {
     await Task.Yield();
 }