//--------------------------------------------------------------------- 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); } }
//--------------------------------------------------------------------- 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); }