Beispiel #1
0
    private Tile[] GetNeighbours()
    {
        Tile[] ns = new Tile[8];
        Tile   n;

        n     = mineField.GetTileAt(x, y + 1);
        ns[0] = n;  // Could be null, but that's okay.
        n     = mineField.GetTileAt(x + 1, y);
        ns[1] = n;  // Could be null, but that's okay.
        n     = mineField.GetTileAt(x, y - 1);
        ns[2] = n;  // Could be null, but that's okay.
        n     = mineField.GetTileAt(x - 1, y);
        ns[3] = n;  // Could be null, but that's okay.
        n     = mineField.GetTileAt(x + 1, y + 1);
        ns[4] = n;  // Could be null, but that's okay.
        n     = mineField.GetTileAt(x + 1, y - 1);
        ns[5] = n;  // Could be null, but that's okay.
        n     = mineField.GetTileAt(x - 1, y - 1);
        ns[6] = n;  // Could be null, but that's okay.
        n     = mineField.GetTileAt(x - 1, y + 1);
        ns[7] = n;  // Could be null, but that's okay.

        return(ns);
    }