示例#1
0
文件: EbGrid.cs 项目: cyecp/GF.Core
        //---------------------------------------------------------------------
        public void entityMove(Entity entity, EbVector3 pos_world)
        {
            EbVector2    pos_grid = _world2gird(pos_world);
            EbGridRegion region   = mGridRegions[(int)pos_grid.x, (int)pos_grid.y];

            if (region == null)
            {
                return;
            }

            EbGridRegion region_last = entity.getUserData <EbGridRegion>();

            if (region.Equals(region_last))
            {
                region.entityMove(entity);
            }
            else
            {
                if (region_last != null)
                {
                    region_last.entityLeaveRegion(entity);
                }
                region.entityEnterRegion(entity);
            }
        }
示例#2
0
文件: EbGrid.cs 项目: cyecp/GF.Core
        //---------------------------------------------------------------------
        public void entityEnterRegion(Entity entity, EbVector3 pos_world)
        {
            EbVector2    pos_grid = _world2gird(pos_world);
            EbGridRegion region   = mGridRegions[(int)pos_grid.x, (int)pos_grid.y];

            if (region == null)
            {
                return;
            }

            region.entityEnterRegion(entity);
        }