/// <summary> /// If one can be found, returns the position of a cell on the specified side which does not /// contain the specified type of dweller. If none can be found, null is returned instead. /// </summary> public CellPosition FindRandomCellWithout(DwellerType type, GridClass side) { List <CellPosition> allCells = ListAllCellsOnSide(side); allCells.Shuffle(); foreach (CellPosition position in allCells) { if (!IsTypeInCell(position, type)) { return(position); } } return(null); }
void DrawDwellerTypeGizmo(Vector3 position, DwellerType type) { if (type == DwellerType.Player) { Gizmos.color = Color.blue; } else if (type == DwellerType.Enemy) { Gizmos.color = Color.red; } Gizmos.DrawLine(position, position + Vector3.up * 5); Gizmos.DrawCube(position + Vector3.up * 3, new Vector3(0.2f, 0.2f, 0.2f)); }
public bool IsTypeInCell(CellPosition position, DwellerType type) { if (!IsValid(position)) { return(false); } if (position.side == GridClass.PlayerGrid) { return(playerSideContents[position.x, position.z].Exists( delegate(GridDweller dweller) { return dweller.type == type; } )); } else { return(enemySideContents[position.x, position.z].Exists( delegate(GridDweller dweller) { return dweller.type == type; } )); } }