Exemplo n.º 1
0
        /*
         * public bool isOccupied()
         * {
         *  return this.Occupied;
         * }
         */
        public WallCell copy()
        {
            WallCell wc = new WallCell();

            wc.wall = this.wall;
            return(wc);
        }
Exemplo n.º 2
0
        public List <WallCell> GetWallCells(string mapName, Size cellSize)
        {
            List <WallCell> wallCellList = new List <WallCell>();

            Connect();
            try
            {
                string query = "SELECT * FROM Cell WHERE MapName = @MapName AND Wallcell = 1";
                using (command = new SqlCommand(query, SQLcon))
                {
                    command.Parameters.Add(new SqlParameter("@MapName", mapName));
                    reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        WallCell wc = new WallCell(ConvertDataToPoint(reader["Coordinaten"].ToString()), cellSize);
                        wallCellList.Add(wc);
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exceptions.QueryFailedException(e.Message);
            }

            Close();
            return(wallCellList);
        }
Exemplo n.º 3
0
    private void ResetCells()
    {
        lCells.Clear();
        lSnakeCells.Clear();

        int r = Screen.height / Cell.isize - 2;
        int c = Screen.width / Cell.isize - 2;

        for (int i = 0; i < r; i++)
        {
            lCells.Add(new List <Cell>());
            for (int j = 0; j < c; j++)
            {
                if (i == 0 || j == 0 || i == r - 1 || j == c - 1)
                {
                    WallCell wc = new WallCell();
                    wc.ix = j;
                    wc.iy = i;
                    lCells[i].Add(wc);
                }
                else
                {
                    EmptyCell wc = new EmptyCell();
                    wc.ix = j;
                    wc.iy = i;
                    lCells[i].Add(wc);
                }
            }
        }

        for (int i = 0; i < 5; i++)
        {
            int       ix = 5 + i;
            int       iy = 5;
            SnakeCell sc = new SnakeCell();
            sc.ix = ix;
            sc.iy = iy;
            lSnakeCells.Insert(0, sc);
            lCells[iy][ix] = sc;
        }

        RandomOneFood();

        bGameOver = false;

        iDirectX = 1;
        iDirectY = 0;
        moveSep  = 1;
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Awake()
    {
        isDoneCreated = false;
        arrWalls      = new WallCell[sizeLebar, sizeTinggi];
        for (int i = 0; i < sizeTinggi; i++)
        {
            for (int j = 0; j < sizeLebar; j++)
            {
                //Debug.Log (i + " , " + j);
                arrWalls [j, i] = new WallCell();
            }
        }
        StartCreateMaze();

//		Debug.Log (arrWalls [1, 8].vector2Position);
//		Debug.Log (arrWalls [1, 8].WallDepan.transform.position);
//		Debug.Log (arrWalls [1, 8].WallKanan.transform.position);
//		Debug.Log (arrWalls [3,1].WallKiri.name);
    }