private void DestroyTiles(fix2 position, fix radius) { TileWorld tileWorld = CommonReads.GetTileWorld(Accessor); NativeList <int2> tiles = new NativeList <int2>(Allocator.Temp); var transformTileRequests = GetSingletonBuffer <SystemRequestTransformTile>(); Job.WithCode(() => { TilePhysics.GetAllTilesWithin(position, radius, tiles); for (int i = 0; i < tiles.Length; i++) { Entity tileEntity = tileWorld.GetEntity(tiles[i]); TileFlagComponent tileFlags = tileWorld.GetFlags(tileEntity); if (!tileFlags.IsOutOfGrid && tileFlags.IsDestructible) { // remove ladder and terrain flags tileFlags.Value &= ~(TileFlags.Ladder | TileFlags.Terrain); transformTileRequests.Add(new SystemRequestTransformTile() { Tile = tiles[i], NewTileFlags = tileFlags }); } } }).Run(); }
public bool Evaluate(int2 tile) { Entity tileEntity = TileWorld.GetEntity(tile); if (tileEntity != Entity.Null) { return(TileWorld.GetFlags(tileEntity).IsTerrain); } return(false); }