public Cell(float x, float y) { ICoord p = GridDefines.ComputeCellCoord(x, y); data.grid_x = p.X_coord / MapConst.MaxCells; data.grid_y = p.Y_coord / MapConst.MaxCells; data.cell_x = p.X_coord % MapConst.MaxCells; data.cell_y = p.Y_coord % MapConst.MaxCells; }
public static CellArea CalculateCellArea(float x, float y, float radius) { if (radius <= 0.0f) { CellCoord center = (CellCoord)GridDefines.ComputeCellCoord(x, y).Normalize(); return(new CellArea(center, center)); } CellCoord centerX = (CellCoord)GridDefines.ComputeCellCoord(x - radius, y - radius).Normalize(); CellCoord centerY = (CellCoord)GridDefines.ComputeCellCoord(x + radius, y + radius).Normalize(); return(new CellArea(centerX, centerY)); }
public static void VisitWorldObjects(float x, float y, Map map, Notifier visitor, float radius, bool dont_load = true) { CellCoord p = GridDefines.ComputeCellCoord(x, y); Cell cell = new Cell(p); if (dont_load) { cell.SetNoCreate(); } Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld); cell.Visit(p, gnotifier, map, x, y, radius); }
public static void VisitWorldObjects(WorldObject center_obj, Notifier visitor, float radius, bool dont_load = true) { CellCoord p = GridDefines.ComputeCellCoord(center_obj.GetPositionX(), center_obj.GetPositionY()); Cell cell = new Cell(p); if (dont_load) { cell.SetNoCreate(); } Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld); cell.Visit(p, gnotifier, center_obj.GetMap(), center_obj, radius); }