|
if (stampColors[tempPixel] != targetColor) //if the pixel is not the target color, move on |
If this if check returns true and continues, this means that the pixel that was found is a neighboring pixel. Keeping a dictionary to track all pieces that were neighboring that pixel as they are generated would be a good idea.
Dictionary<int, List<int>> pixelDict = new Dictionary<int, List<int>>();
if (stampColors[tempPixel] != targetColor) //if the pixel is not the target color, move on
{
if(!pixelDict.ContainsKey(tempPixel))
{
pixelDict.Add(tempPixel, new List<int>());
}
pixelDict[tempPixel].Add(pieceNum);
continue;
}
if(pixelDict.ContainsKey(tempPixel)
//This set all pieces in the list as matches to one another
PuzzleStamp/PuzzleStamp/Assets/Scripts/ThreadedPuzzleStamp.cs
Line 75 in afb4b2f
If this if check returns true and continues, this means that the pixel that was found is a neighboring pixel. Keeping a dictionary to track all pieces that were neighboring that pixel as they are generated would be a good idea.