private bool NearEntitiesEvent(Entity entity, StateToStateEvent stateToStateEvent) { // TODO: Calculate right min, max by using scoreAreaSize and spherical world. int imin = Math.Max(0, entity.i - 1); int imax = Math.Min(entity.i + 1, this.cells.GetLength(0) - 1); int jmin = Math.Max(0, entity.j - 1); int jmax = Math.Min(entity.j + 1, this.cells.GetLength(1) - 1); bool isRun = true; for (int i = imin; i <= imax && isRun; ++i) { for (int j = jmin; j <= jmax && isRun; ++j) { for (int k = 0; k < cells[i, j].Count && isRun; ++k) { stateToStateEvent(entity, cells[i, j][k], ref isRun); } } } return(isRun); }
private bool NearEntitiesEvent(Entity entity, StateToStateEvent stateToStateEvent) { // TODO: Calculate right min, max by using scoreAreaSize and spherical world. int imin = Math.Max(0, entity.i - 1); int imax = Math.Min(entity.i + 1, this.cells.GetLength(0) - 1); int jmin = Math.Max(0, entity.j - 1); int jmax = Math.Min(entity.j + 1, this.cells.GetLength(1) - 1); bool isRun = true; for (int i = imin; i <= imax && isRun; ++i) { for (int j = jmin; j <= jmax && isRun; ++j) { for (int k = 0; k < cells[i, j].Count && isRun; ++k) { stateToStateEvent(entity, cells[i, j][k], ref isRun); } } } return isRun; }