示例#1
0
    /// <summary>
    /// Applies a cell group pattern to the codemap as a method of path generation,
    /// or at least generating paths piece by piece in pathSize increments
    /// </summary>
    /// <param name="cellLoc">The bottom left corner of the cell group to be applied</param>
    /// <param name="originIndex">The index at which to add the next cell, -1 means on the end</param>
    private void ApplyCellGroupToCodeMap(CustomTuple <int, int> cellLoc, int originIndex)
    {
        if (originIndex == -1)
        {
            allCellOrigins.Add(cellLoc.Copy());
        }
        else
        {
            allCellOrigins.Insert(originIndex, cellLoc.Copy());
        }

        //iterate through the entire cell group, border included
        for (int i = cellLoc.x - 1; i < cellLoc.x + currentPathWidth + 1; i++)
        {
            for (int j = cellLoc.y - 1; j < cellLoc.y + currentPathWidth + 1; j++)
            {
                //if the current cell is on the border of this group try to make it a border cell
                if (i == cellLoc.x - 1 || i == cellLoc.x + currentPathWidth ||
                    j == cellLoc.y - 1 || j == cellLoc.y + currentPathWidth)
                {
                    codeMap[i, j] = GetPrevailingCode(codeMap[i, j], 1);
                }
                else //if not, try to make it a path cell
                {
                    codeMap[i, j] = GetPrevailingCode(codeMap[i, j], 0);
                }
            }
        }
    }
示例#2
0
 public CustomTuple <int, int> GetEnd()
 {
     return(final.Copy());
 }
示例#3
0
 public bool SetPos(CustomTuple <int, int> pos)
 {
     position = pos.Copy();
     CalculateFinal();
     return(true);
 }
示例#4
0
 public CustomTuple <int, int> GetStart()
 {
     return(position.Copy());
 }