Tilemap 瓦片地图
class in UnityEngine.Tilemaps
/
Inherits from:GridLayout
/
Implemented in:UnityEngine.TilemapModule
UnityEngine.Tilemaps中的类
/
继承自:GridLayout
/
Properties 属性
| 动画帧速率 | animationFrameRate | 拼贴图中所有拼贴动画的帧频。 | The frame rate for all tile animations in the tile map. |
| 单元格边界 | cellBounds | 返回单元格大小中TileMap的边界。 | Returns the boundaries of the Tilemap in cell size. |
| 颜色 | color | 平铺地图图层的颜色。 | The color of the tile map layer. |
| 编辑器预览原点 | editorPreviewOrigin | 单元格位置中的Tilemap的原点,包括编辑器预览图块。 | The origin of the Tilemap in cell position inclusive of editor preview tiles. |
| 编辑器预览大小 | editorPreviewSize | 包含编辑器预览图块的单元格中Tilemap的大小。 | The size of the Tilemap in cells inclusive of editor preview tiles. |
| 布局网格 | layoutGrid | 获取与此瓦片地图关联的Grid。 | Gets the Grid associated with this tile map. |
| 局部范围 | localBounds | 以局部空间大小返回Tilemap的边界。 | Returns the boundaries of the Tilemap in local space size. |
| 方向 | orientation | Tilemap中瓦片的方向。 | Orientation of the tiles in the Tilemap. |
| 方向矩阵 | orientationMatrix | Tilemap中瓦片的方向的方向矩阵。 | Orientation Matrix of the orientation of the tiles in the Tilemap. |
| 原点 | origin | Tilemap在单元格位置的原点。 | The origin of the Tilemap in cell position. |
| 大小 | size | Tilemap的大小(以单元格为单位) | The size of the Tilemap in cells. |
| 瓦片锚点 | tileAnchor | 获取Tilemap中瓦片的锚点。 | Gets the anchor point of tiles in the Tilemap. |
Public Methods 公共方法
| 添加瓦片标志 | AddTileFlags | 在给定位置将TileFlags添加到Tile上。 | Adds the TileFlags onto the Tile at the given position. |
| 方框填充 | BoxFill | 在瓦片地图上用给定的瓦片填充一个方框。从给定的坐标开始,从starts到end的填充限制(包括端点)。 | Does a box fill with the given tile on the tile map. Starts from given coordinates and fills the limits from start to end (inclusive). |
| 清除所有编辑器预览瓦片 | ClearAllEditorPreviewTiles | 清除放置在Tilemap中的所有编辑器预览瓦片。 | Clears all editor preview tiles that are placed in the Tilemap. |
| 清除所有瓦片 | ClearAllTiles | 清除放置在Tilemap中的所有图块。 | Clears all tiles that are placed in the Tilemap. |
| 压缩边界 | CompressBounds | 将Tilemap的原点和大小压缩到存在Tile的边界。 | Compresses the origin and size of the Tilemap to bounds where tiles exist. |
| 包含瓦片 | ContainsTile | 如果Tilemap包含指定的tile,则返回true。如果不是,则返回false。 | Returns true if the Tilemap contains the given tile. Returns false if not. |
| 编辑器预览方框填充 | EditorPreviewBoxFill | 编辑器预览一个方块框,并在瓦片地图上用指定的瓦片填充。从指定的坐标开始,并从starts到end(包括端点)填充限制。 | Does an editor preview of a box fill with the given tile on the tile map. Starts from given coordinates and fills the limits from start to end (inclusive). |
| 编辑器预览漫水填充 | EditorPreviewFloodFill | 编辑器是否使用指定的瓦片预览漫水填充。在瓦片地图上从指定的坐标开始。 | Does an editor preview of a flood fill with the given tile to place. on the tile map starting from the given coordinates. |
| 漫水填充 | FloodFill | 用给定的瓦片洪水填充到指定的位置。在瓦片地图上从给定的坐标开始 | Does a flood fill with the given tile to place. on the tile map starting from the given coordinates. |
| 获取局部空间的网格中心 | GetCellCenterLocal | 获取局部空间中网格单元的逻辑中心坐标。 | Get the logical center coordinate of a grid cell in local space. |
| 获取事件世界空间的网格中心 | GetCellCenterWorld | 获取世界空间中网格单元的逻辑中心坐标。 | Get the logical center coordinate of a grid cell in world space. |
| 获取碰撞器类型 | GetColliderType | 给定瓦片地图中某个单元格的XYZ坐标,获取瓦片的对撞机类型。 | Gets the collider type of a tile given the XYZ coordinates of a cell in the tile map. |
| 获取颜色 | GetColor | 给定瓦片地图中某个单元格的XYZ坐标,获取瓦片的颜色。 | Gets the color of a tile given the XYZ coordinates of a cell in the tile map. |
| 获取编辑器预览颜色 | GetEditorPreviewColor | 给定瓦片地图中单元格的XYZ坐标,获取编辑器预览瓦片的颜色。 | Gets the Color of an editor preview tile given the XYZ coordinates of a cell in the tile map. |
| 获得编辑器预览精灵 | GetEditorPreviewSprite | 给定瓦片地图中某个单元格的XYZ坐标,获取在编辑器预览瓦片中使用的Sprite。 | Gets the Sprite used in an editor preview tile given the XYZ coordinates of a cell in the tile map. |
| 获取编辑器预览瓦片 | GetEditorPreviewTile | 在图块地图中单元格的给定XYZ坐标处获取编辑器预览图块。 | Gets the editor preview tile at the given XYZ coordinates of a cell in the tile map. |
| 获取编辑器预览TileFlags | GetEditorPreviewTileFlags | 在给定位置获取编辑器预览Tile的TileFlags。 | Gets the TileFlags of the editor preview Tile at the given position. |
| 获取编辑器变换矩阵 | GetEditorPreviewTransformMatrix | 给定瓦片地图中某个单元格的XYZ坐标,获取编辑器预览瓦片的变换矩阵。 | Gets the transform matrix of an editor preview tile given the XYZ coordinates of a cell in the tile map. |
| 获取实例化的对象 | GetInstantiatedObject | 给定瓦片实例化的GameObject,并赋予其在瓦片地图中某个单元的XYZ坐标。 | Gets the GameObject instantiated by a tile given the XYZ coordinates of a cell in the tile map. |
| 获取精灵 | GetSprite | 给定瓦片地图中某个单元格的XYZ坐标,获取在瓦片中使用的Sprite。 | Gets the Sprite used in a tile given the XYZ coordinates of a cell in the tile map. |
| 获取瓦片 | GetTile | 在图块地图中以单元格的给定XYZ坐标获取图块。 | Gets the tile at the given XYZ coordinates of a cell in the tile map. |
| 获取TileFlags | GetTileFlags | 在给定位置获取Tile的TileFlags。 | Gets the TileFlags of the Tile at the given position. |
| 获取成批的瓦片 | GetTilesBlock | 检索具有给定范围的图块数组。 | Retrieves an array of tiles with the given bounds. |
| 获取变换矩阵 | GetTransformMatrix | 给定图块地图中某个单元格的XYZ坐标,获取瓦片的变换矩阵。 | Gets the transform matrix of a tile given the XYZ coordinates of a cell in the tile map. |
| 获取使用的瓦片总数 | GetUsedTilesCount | 获取Tilemap中使用的不同瓦片的总数。 | Get the total number of different tiles used in the Tilemap. |
| 获取使用的瓦片-非内存 | GetUsedTilesNonAlloc | 使用Tilemap中使用的不同图块的总数填充给定数组,并返回填充的图块数量。 | Fills the given array with the total number of different tiles used in the Tilemap and returns the number of tiles filled. |
| 是否有编辑器预览瓦片 | HasEditorPreviewTile | 返回该位置是否有编辑器预览图块。 | Returns whether there is an editor preview tile at the position. |
| 是否有瓦片 | HasTile | 返回该位置是否有图块。 | Returns whether there is a tile at the position. |
| 刷新所有瓦片 | RefreshAllTiles | 刷新图块贴图中的所有图块。瓦片贴图将检索所有瓦片的渲染数据,动画数据和其他数据,并更新所有相关组件。 | Refreshes all tiles in the tile map. The tile map will retrieve the rendering data, animation data and other data for all tiles and update all relevant components. |
| 刷新瓦片 | RefreshTile | 在图块映射中的单元格的给定坐标处刷新图块。 | Refreshes a tile at the given coordinates of a cell in the tile map. |
| 移除TileFlags | RemoveTileFlags | 在给定位置将TileFlags移除到Tile上。 | Removes the TileFlags onto the Tile at the given position. |
| 调整范围 | ResizeBounds | 将Tilemap中的瓦片调整为由原点和大小定义的范围。。 | Resizes tiles in the Tilemap to bounds defined by origin and size. |
| 设置碰撞器类型 | SetColliderType | 给定图块贴图中单元格的XYZ坐标,设置图块的对撞机类型。 | Sets the collider type of a tile given the XYZ coordinates of a cell in the tile map. |
| 设置颜色 | SetColor | 给定图块贴图中单元格的XYZ坐标,设置图块的颜色。 | Sets the color of a tile given the XYZ coordinates of a cell in the tile map. |
| 设置编辑器预览颜色 | SetEditorPreviewColor | 给定图块贴图中单元格的XYZ坐标,设置编辑器预览图块的颜色。 | Sets the color of an editor preview tile given the XYZ coordinates of a cell in the tile map. |
| 设置编辑器预览瓦片 | SetEditorPreviewTile | 给定图块地图中单元格的XYZ坐标,设置编辑器预览图块。 | Sets an editor preview tile given the XYZ coordinates of a cell in the tile map. |
| 设置编辑器预览变换坐标 | SetEditorPreviewTransformMatrix | 给定图块贴图中单元格的XYZ坐标,设置编辑器预览图块的变换矩阵。 | Sets the transform matrix of an editor preview tile given the XYZ coordinates of a cell in the tile map. |
| 设置瓦片 | SetTile | 在图块贴图中的单元格的给定XYZ坐标处设置图块。 | Sets a tile at the given XYZ coordinates of a cell in the tile map. |
| 设置TileFlags | SetTileFlags | 在给定位置将TileFlags设置在Tile上。 | Sets the TileFlags onto the Tile at the given position. |
| 设置瓦片数组 | SetTiles | 在图块地图中相应像元的给定XYZ坐标处设置图块数组。 | Sets an array of tiles at the given XYZ coordinates of the corresponding cells in the tile map. |
| 设置成批的瓦片 | SetTilesBlock | 用图块阵列填充边界。 | Fills bounds with array of tiles. |
| 设置变换矩阵 | SetTransformMatrix | 给定图块贴图中单元格的XYZ坐标,设置图块的变换矩阵。 | Sets the transform matrix of a tile given the XYZ coordinates of a cell in the tile map. |
| 交换瓦片 | SwapTile | 将所有现有的changeTile瓦片交换为newTile,并刷新所有交换的瓦片。 | Swaps all existing tiles of changeTile to newTile and refreshes all the swapped tiles. |
Inherited Members 基础成员
Properties 属性
| 已启用 | enabled | 启用行为已更新,禁用行为未更新。 | Enabled Behaviours are Updated, disabled Behaviours are not. |
| 行为是否已启用 | isActiveAndEnabled | 该行为是否已激活并已启用? | Has the Behaviour had active and enabled called? |
| 游戏对象 | gameObject | 该组件附加到的游戏对象。组件始终附加在游戏对象上。 | The game object this component is attached to. A component is always attached to a game object. |
| 标签 | tag | 此游戏对象的标签。 | The tag of this game object. |
| 变换 | transform | 附加到此GameObject的Transform。 | The Transform attached to this GameObject. |
| 单元格间隙 | cellGap | 布局中每个单元格之间的间隙大小。 | The size of the gap between each cell in the layout. |
| 单元格布局 | cellLayout | 单元格的布局。 | The layout of the cells. |
| 单元格大小 | cellSize | 布局中每个单元格的大小。 | The size of each cell in the layout. |
| 单元格朝向 | cellSwizzle | 整个单元格的布局朝向 | The cell swizzle for the layout. |
| 隐藏标志 | hideFlags | 该对象是否应该隐藏,随场景保存或可由用户修改? | Should the object be hidden, saved with the Scene or modifiable by the user? |
| 名字 | name | 对象的名称。 | The name of the object. |
Public Methods 公共方法
| 广播信息 | BroadcastMessage | 在此游戏对象或其任何子级中的每个MonoBehaviour上调用名为methodName的方法。 | Calls the method named methodName on every MonoBehaviour in this game object or any of its children. |
| 比较标签 | CompareTag | 这个游戏对象是否带有标签? | Is this game object tagged with tag ? |
| 获取组件 | GetComponent | 如果游戏对象附加了一个,则返回Type类型的组件;如果没有,则返回null。 | Returns the component of Type type if the game object has one attached, null if it doesn't. |
| 获取子类的组件 | GetComponentInChildren | 使用深度优先搜索返回GameObject或其任何子级中Type类型的组件。 | Returns the component of Type type in the GameObject or any of its children using depth first search. |
| 获取父类的组件 | GetComponentInParent | 返回GameObject或其任何父代中Type类型的组件。 | Returns the component of Type type in the GameObject or any of its parents. |
| 获取组件(s) | GetComponents | 返回GameObject中Type类型的所有组件。 | Returns all components of Type type in the GameObject. |
| 获取子类的组件(s) | GetComponentsInChildren | 返回GameObject或其任何子级中Type类型的所有组件。 | Returns all components of Type type in the GameObject or any of its children. |
| 获取父类的组件(s) | GetComponentsInParent | 返回GameObject或其任何父代中Type类型的所有组件。 | Returns all components of Type type in the GameObject or any of its parents. |
| 发送消息 | SendMessage | 在此游戏对象中的每个MonoBehaviour上调用名为methodName的方法。 | Calls the method named methodName on every MonoBehaviour in this game object. |
| 向上发送消息 | SendMessageUpwards | 在此游戏对象中的每个MonoBehaviour以及该行为的每个祖先上调用名为methodName的方法。 | Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour. |
| 试着获取组件 | TryGetComponent | 获取指定类型的组件(如果存在)。 | Gets the component of the specified type, if it exists. |
| 单元格到局部 | CellToLocal | 将像元位置转换为局部位置空间。 | Converts a cell position to local position space. |
| 单元格到局部插值 | CellToLocalInterpolated | 将浮点数中的插值像元位置转换为局部位置空间。 | Converts an interpolated cell position in floats to local position space. |
| 单元格到世界 | CellToWorld | 将像元位置转换为世界位置空间。 | Converts a cell position to world position space. |
| 单元格局部范围 | GetBoundsLocal | 返回该位置的单元格的局部范围。 | Returns the local bounds for a cell at the location. |
| 获取布局单元格中心 | GetLayoutCellCenter | 获取网格的默认中心坐标以设置网格的布局。 | Get the default center coordinate of a cell for the set layout of the Grid. |
| 局部到单元格 | LocalToCell | 将本地位置转换为单元格位置。 | Converts a local position to cell position. |
| 局部到单元格插值 | LocalToCellInterpolated | 将本地位置转换为单元格位置。 | Converts a local position to cell position. |
| 局部到世界 | LocalToWorld | 将本地位置转换为世界位置。 | Converts a local position to world position. |
| 世界到单元格 | WorldToCell | 将世界位置转换为单元位置。 | Converts a world position to cell position. |
| 世界到局部 | WorldToLocal | 将世界位置转换为本地位置。 | Converts a world position to local position. |
| 获取实例ID | GetInstanceID | 返回对象的实例ID。 | Returns the instance id of the object. |
| 返回字符串 | ToString | 返回对象的名称。 | Returns the name of the object. |
Static Methods 静态方法
| 销毁时 | Destroy | 移除GameObject,组件或资产。 | Removes a GameObject, component or asset. |
| 立即销毁 | DestroyImmediate | 立即销毁对象obj。强烈建议您改用销毁。 | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
| 不在加载时销毁 | DontDestroyOnLoad | 加载新场景时,请勿破坏目标对象。 | Do not destroy the target Object when loading a new Scene. |
| 获取对象类型 | FindObjectOfType | 返回第一个Type类型的活动加载对象。 | Returns the first active loaded object of Type type. |
| 获取对象(s)类型 | FindObjectsOfType | 返回所有类型为Type的活动加载对象的列表。 | Returns a list of all active loaded objects of Type type. |
| 实例化 | Instantiate | 克隆对象原始对象并返回克隆。 | Clones the object original and returns the clone. |
Operators 运算符
| 布尔 | bool | 该对象是否存在? | Does the object exist? |
| 运算符 | operator != | 比较两个对象是否引用了另一个对象。 | Compares if two objects refer to a different object. |
| 运算符 | operator == | 比较两个对象引用以查看它们是否引用相同的对象。 | Compares two object references to see if they refer to the same object. |