Пример #1
0
 /// <summary>
 /// Removes a cell from the grid
 /// </summary>
 /// <param name="cellToRemove"></param>
 internal void RemoveCell(IInternalCell cellToRemove)
 {
     if (cellToRemove != null)
         Grid[cellToRemove.Position.X, cellToRemove.Position.Y].CellReference = null;
     else
         throw new Exception("Cannot remove a non existing cell");
 }
Пример #2
0
 /// <summary>
 /// Function registering a cell on the map
 /// </summary>
 /// <param name="newCell">The cell</param>
 internal void ImplantCell(IInternalCell newCell)
 {
     if (newCell != null)
         Grid[newCell.Position.X, newCell.Position.Y].CellReference = newCell;
     else
         throw new Exception("Cannot implant a non existing cell");
 }
Пример #3
0
        /// <summary>
        /// Injects the cell into the game 
        /// (should only be done by the world itself just before the begining of the turn)
        /// </summary>
        /// <param name="newCell">The cell</param>
        private void InjectCell(IInternalCell newCell)
        {
            // Add the cell to the cell list
            this.cells.Add(newCell);

            // Implant the cell on the map
            this.masterMap.ImplantCell(newCell);
        }
Пример #4
0
        /// <summary>
        /// Register a new cell into the game
        /// </summary>
        /// <param name="newCell"></param>
        private void RegisterNewCell(IInternalCell newCell)
        {
            if (newCell.Position.X == 100)
            {}

            this.newCellsToAdd.Add(newCell);
        }
Пример #5
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>
 public void UnregisterCell(IInternalCell cell)
 {
     deadCellsToRemove.Add(cell);
 }
Пример #6
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>
 public SurroundingView GetSurroundingsView(IInternalCell cell)
 {
     MapTile[,] map = masterMap.GetSubset(cell.Position, Settings.Default.SensoryViewSize, Settings.Default.SensoryViewSize);
     return new SurroundingView(cell.Position, map);
 }