Ejemplo n.º 1
0
        public Ship(User owner, int width, int height)
        {
            this.owner = owner;

            cells  = new Cell[height][];
            status = new CellStatus[height][];
            for (int i = 0; i < height; i++)
            {
                cells[i]  = new Cell[width];
                status[i] = new CellStatus[width];
            }
        }
Ejemplo n.º 2
0
        public Ship(User owner, int width, int height)
        {
            this.owner = owner;

            cells = new Cell[height][];
            status = new CellStatus[height][];
            for (int i = 0; i < height; i++)
            {
                cells[i] = new Cell[width];
                status[i] = new CellStatus[width];
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets status field for every Cell in ship.cells
        /// Room with the same roomId should have same staus
        /// </summary>
        /// <param name="ship"></param>
        /// <param name="preset"></param>
        private void InitCellStatuses(Ship ship, ShipPreset preset)
        {
            for (int i = 0; i < ship.cells.Length; i++)
            {
                for (int j = 0; j < ship.cells[i].Length; j++)
                {
                    int roomId = preset.RoomIds[i, j];

                    if (!assignesStatuses.ContainsKey(roomId))
                        assignesStatuses[roomId] = new CellStatus() { energy = 0, health = 10 };

                    assignesStatuses[roomId].cellsInRoomCount++;
                    ship.cells[i][j].status =
                        ship.status[i][j] =
                        assignesStatuses[roomId];
                }
            }
        }