Esempio n. 1
0
        //---------------------------------------------------------------------
        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);
            }
        }
Esempio n. 2
0
        //---------------------------------------------------------------------
        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);
        }