Beispiel #1
0
        public CellMgr GetCell(ushort x, ushort y)
        {
            if (x >= MaxCellID)
            {
                x = (ushort)(MaxCellID - 1);
            }
            if (y >= MaxCellID)
            {
                y = (ushort)(MaxCellID - 1);
            }

            return(Cells[x, y] ?? (Cells[x, y] = new CellMgr(this, x, y)));
        }
Beispiel #2
0
        public CellMgr GetCell(UInt16 X, UInt16 Y)
        {
            if (X >= MAX_CELL_ID)
            {
                X = (UInt16)(MAX_CELL_ID - 1);
            }
            if (Y >= MAX_CELL_ID)
            {
                Y = (UInt16)(MAX_CELL_ID - 1);
            }

            if (_Cells[X, Y] == null)
            {
                _Cells[X, Y] = new CellMgr(this, X, Y);
            }

            return(_Cells[X, Y]);
        }
Beispiel #3
0
        public void CheckZone(Object Obj)
        {
            Zone_Info Info = GetZone(Obj.XOffset, Obj.YOffset);

            if (Info != null && Info != Obj.Zone.Info)
            {
                AddObject(Obj, Info.ZoneId);
            }

            CellMgr CurCell = Obj._Cell;
            CellMgr NewCell = GetCell(Obj.XOffset, Obj.YOffset);

            if (NewCell != null && NewCell != CurCell)
            {
                if (CurCell != null) // Si l'objet est sur un cell, on le supprime
                {
                    CurCell.RemoveObject(Obj);
                }

                NewCell.AddObject(Obj); // On l'ajoute dans le nouveau cell
            }
        }
Beispiel #4
0
        public ushort CheckZone(Object obj)
        {
            Zone_Info info = GetZone(obj.XOffset, obj.YOffset);

            if (info != null && info != obj.Zone.Info)
            {
                AddObject(obj, info.ZoneId);
            }

            CellMgr curCell = obj._Cell;
            CellMgr newCell = GetCell(obj.XOffset, obj.YOffset);

            if (newCell == null || newCell == curCell)
            {
                return(info?.ZoneId ?? 0);
            }

            curCell?.RemoveObject(obj);
            newCell.AddObject(obj); // On l'ajoute dans le nouveau cell

            return(info?.ZoneId ?? 0);
        }
Beispiel #5
0
        public CellMgr GetCell(UInt16 X, UInt16 Y)
        {
            if (X >= MAX_CELL_ID) X = (UInt16)(MAX_CELL_ID - 1);
            if (Y >= MAX_CELL_ID) Y = (UInt16)(MAX_CELL_ID - 1);

            if (_Cells[X,Y] == null)
                _Cells[X, Y] = new CellMgr(this, X, Y);

            return _Cells[X, Y];
        }