Ejemplo n.º 1
0
    public QCell[,] GetContentAsMatrix()
    {
        var result = new QCell[Rows, Columns];

        foreach (var cell in cells.Values)
        {
            result[cell.Row, cell.Column] = new QCell((short)cell.state, (short)(cell.NorthWall ? 1 : 0),
                                                      (short)(cell.SouthWall ? 1 : 0), (short)(cell.EastWall ? 1 : 0), (short)(cell.WestWall ? 1 : 0));
        }

        return(result);
    }
Ejemplo n.º 2
0
    //Constrói a tabela, atribuindo 0 para todas as células
    private void BuildTable()
    {
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                TabelaQ[i, j]         = new QCell();
                TabelaQ[i, j].State   = tileMap[i].Collumns[j];
                TabelaQ[i, j].Actions = new List <ActionQuality>();

                //Esquerda
                if (j - 1 >= 0)
                {
                    TabelaQ[i, j].Actions.Add(new ActionQuality(Action.Left, 0));
                }

                //Direita
                if (j + 1 < tileMap[0].Collumns.Length)
                {
                    TabelaQ[i, j].Actions.Add(new ActionQuality(Action.Right, 0));
                }

                //Cima
                if (i - 1 >= 0)
                {
                    TabelaQ[i, j].Actions.Add(new ActionQuality(Action.Up, 0));
                }

                //Baixo
                if (i + 1 < tileMap.Length)
                {
                    TabelaQ[i, j].Actions.Add(new ActionQuality(Action.Down, 0));
                }
            }
        }
    }