protected void PrintRaid() { StringBuilder sb = new StringBuilder(); int numCols = RaidSizeUtil.GetCols(Size); int col = 0; foreach (Entity raider in Raiders) { sb.Append(raider.Name + "\t"); col++; if (col == numCols) { col = 0; Debug.Log(sb.ToString()); sb = new StringBuilder(); } } }
public IList <Entity> GetSplash(Coordinate center) { var list = new List <Entity>(); for (int r = -1; r <= 1; r++) { for (int c = -1; c <= 1; c++) { Coordinate coord = new Coordinate(center.Row + r, center.Col + c); if (coord.Row >= 0 && coord.Row < RaidSizeUtil.GetRows(Size) && coord.Col >= 0 && coord.Col < RaidSizeUtil.GetCols(Size)) { list.Add(GetRaider(coord)); } } } return(list); }
protected int CoordToIndex(Coordinate coord) { int cols = RaidSizeUtil.GetCols(Size); return(coord.Row * cols + coord.Col); }
protected Coordinate IndexToCoord(int index) { int cols = RaidSizeUtil.GetCols(Size); return(new Coordinate(index / cols, index % cols)); }