Exemplo n.º 1
0
        private Point GetNearbyPixel(Point origin, NearbyPosition relative)
        {
            if (LastPoint == origin)
            {
                LastPointCount++;
                //Console.WriteLine("Stuck on {0} for {1} ticks!",origin,LastPointCount);
                if (LastPointCount > 10)
                {
                    Random r = new Random();
                    origin.Offset(r.Next(1), r.Next(1));
                    return(origin);
                }
            }
            else
            {
                LastPointCount = 0;
                LastPoint      = origin;
            }
            Point offset = origin;
            int   i      = (int)relative;

            offset.Offset(Directions[i, 0], Directions[i, 1]);
            return(Clamp(offset));
        }
Exemplo n.º 2
0
	private Point GetNearbyPixel(Point origin, NearbyPosition relative) 
	{ 
			if(LastPoint==origin)
			{
				LastPointCount++;
				//Console.WriteLine("Stuck on {0} for {1} ticks!",origin,LastPointCount);
				if(LastPointCount>10)
				{
					Random r = new Random();
					origin.Offset(r.Next(1),r.Next(1));
					return origin;
				}
			} else {
				LastPointCount=0;
				LastPoint=origin;
			}
		Point offset = origin; 
		int i = (int)relative;
		offset.Offset(Directions[i,0],Directions[i,1]);
		return Clamp(offset); 
	} 
Exemplo n.º 3
0
 private int GetNearbyPixel(int origin, NearbyPosition relative)
 {
     return(GetArrayIndex(GetNearbyPixel(GetPointFromArrayIndex(origin), relative)));
 }
Exemplo n.º 4
0
	private int GetNearbyPixel(int origin, NearbyPosition relative) 
	{ 
		return GetArrayIndex(GetNearbyPixel(GetPointFromArrayIndex(origin), relative)); 
	}