/// <summary> /// Retrieves the position west of the cell /// </summary> /// <param name="position">Position to check against</param> /// <returns>Cell west of the current cell</returns> private Cell GetWestPosition(Cell position) { int x = (position.X == 0) ? Cells.Count - 1 : position.X - 1; return Cells[x][position.Y]; }
/// <summary> /// Retrieves the position South of the cell /// </summary> /// <param name="position">Position to check against</param> /// <returns>Cell south of the current cell</returns> private Cell GetSouthPosition(Cell position) { int y = (position.Y == Cells.Count - 1) ? 0 : position.Y + 1; return Cells[position.X][y]; }
/// <summary> /// Retrieves the position east of the cell /// </summary> /// <param name="position">Position to check against</param> /// <returns>Cell east of the current cell</returns> private Cell GetEastPosition(Cell position) { int x = (position.X == Cells.Count - 1) ? 0 : position.X + 1; return Cells[x][position.Y]; }
/// <summary> /// Retrieves the position north of the cell /// </summary> /// <param name="position">Position to check against</param> /// <returns>Cell north of the current cell</returns> private Cell GetNorthPosition(Cell position) { int y = (position.Y == 0) ? Cells.Count - 1 : position.Y - 1; return Cells[position.X][y]; }
/// <summary> /// Loads the positions around the light cycle /// </summary> /// <param name="lightCycle">Light cycle to load positions for</param> public void LoadPositions(Cell cell) { cell.North = GetNorthPosition(cell); cell.South = GetSouthPosition(cell); cell.East = GetEastPosition(cell); cell.West = GetWestPosition(cell); }