/// <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"); }
/// <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"); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }