Exemple #1
0
    HallMaze FromNodeToArray(NodeGraph node)
    {
        int w, h;

        if (node.type == 0)
        {
            //hall normal
            w = Random.Range(4, 6) * 2 + 1;
            h = Random.Range(4, 6) * 2 + 1;
        }
        else
        {
            //salinha
            w = 5;            //Random.Range (5, 8);
            h = 5;            //Random.Range (5, 8);
        }
        HallMaze hallMaze = new HallMaze(node.id, w, h, node.type);

        hallMaze.Expand(expansionFactor, expansionFactor);
        node.maze = hallMaze;
        int beginDir = Random.Range(0, 4);

        if (node.father != null)
        {
            beginDir = GenerateDir(beginDir);
            SetTransitions(
                node.father.maze,
                node.maze,
                beginDir
                );
        }

        return(hallMaze);
    }
Exemple #2
0
 public NodeGraph(int id, int type = 0, NodeGraph father = null)
 {
     this.id     = id;
     this.type   = type;
     maze        = null;
     this.father = father;
     children    = new List <NodeGraph> ();
 }