Ejemplo n.º 1
0
 internal void CreateSpawns(short spawnLife, Cell cell)
 {
     this.InjectCell(new Cell(cell.Position.X, cell.Position.Y, spawnLife, this, cell.GetTeamColor()));
     this.InjectCell(new Cell(cell.Position.X, cell.Position.Y, spawnLife, this, cell.GetTeamColor()));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Injects the cell into the game
        /// </summary>
        /// <param name="newCell">The cell</param>
        private void InjectCell(Cell newCell)
        {
            // Add the cell to the cell list
            _cells.Add(newCell);

            // Implant the cell on the map
            _masterMap.ImplantCell(newCell);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Function creating a view of the surroundings of the cell and returning it
        /// For anti-cheating purpose, the world gets the cells position himself instead of getting them as parameters
        /// </summary>
        /// <param name="cell">The cell asking</param>
        /// <returns>A SurroundingView of the location where the cell resides</returns>
        internal SurroundingView GetSurroundingsView(Cell cell)
        {
            MapTile[,] map = this._masterMap.GetSubset(cell.Position, _subViewSize, _subViewSize);

            if (map == null)
            { 
            }

            return new SurroundingView(cell.Position, map);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Flags the cell as "can be removed"
 /// </summary>
 /// <param name="cell">The cell to remove</param>
 /// <remarks>
 /// We do not remove the cell right away
 /// The cells are effectively removed at the end of the game loop
 /// </remarks>
 internal void UnregisterCell(Cell cell)
 {
     _deadCellsToRemove.Add(cell);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Removes a cell from the grid
 /// </summary>
 /// <param name="cellToRemove"></param>
 internal void RemoveCell(Cell cellToRemove)
 {
     if (cellToRemove != null)
         Grid[cellToRemove.Position.X, cellToRemove.Position.Y].CellReference = null;
     else
         throw new Exception("Cannot remove a non existing cell");
 }