/// returns a human-readable string representation of the pattern
        public static string PatternToString(Pattern p)
        {
            Vector3Int size = p.Size;
            string     str  = "";

            for (int x = 0; x < size.x; x++)
            {
                for (int y = 0; y < size.y; y++)
                {
                    for (int z = 0; z < size.z; z++)
                    {
                        str += p.GetTile(new Vector3Int(x, y, z)).Label;
                        if (z != size.z - 1)
                        {
                            str += " ";
                        }
                    }
                    if (y != size.y - 1)
                    {
                        str += ",";
                    }
                }
                if (x != size.x - 1)
                {
                    str += ";";
                }
            }

            return(str);
        }
Пример #2
0
 private Vector3Int CalculateDirection(Pattern p, Vector3Int pos)
 {
     if (IsRoom(p.GetTile(pos - Vector3Int.right)))
     {
         return(Vector3Int.right);
     }
     else if (IsRoom(p.GetTile(pos - Vector3Int.up)))
     {
         return(Vector3Int.up);
     }
     else if (IsRoom(p.GetTile(pos - new Vector3Int(0, 0, 1))))
     {
         return(new Vector3Int(0, 0, 1));
     }
     else
     {
         return(Vector3Int.zero);
     }
 }