Beispiel #1
0
    void SetStartingCell()
    {
        int rows = gameObject.GetComponent <GameManager>().rows;

        rowIndex    = UnityEngine.Random.Range(0, rows - 1);
        colIndex    = 0;
        currentCell = grid[rowIndex, colIndex].GetComponentInParent <GridCell>();
        currentCell.DestroyWall("west");
        currentCell.floor.GetComponent <Renderer>().material.color = Color.blue;
        gameObject.GetComponent <GameManager>().spawnPoint         = currentCell;
    }
Beispiel #2
0
    void RemoveWalls(GridCell current, GridCell next)
    {
        int rowDiff = current.rowIndex - next.rowIndex;
        int colDiff = current.colIndex - next.colIndex;

        if (rowDiff == 1)
        {
            current.DestroyWall("north");
        }
        if (colDiff == 1)
        {
            current.DestroyWall("west");
        }
        if (rowDiff == -1)
        {
            current.DestroyWall("south");
        }
        if (colDiff == -1)
        {
            current.DestroyWall("east");
        }
    }