Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }