Esempio n. 1
0
        /// <summary>
        /// 绘制标识网格
        /// </summary>
        private void DrawPrevuewCell()
        {
            if (GameDataCentre.IsAssetLoadCompleted == false)
            {
                return;
            }
            Vector2Int MouseCellPosition = GetMouseCellPosition();

            if (CurrentUnderCell != MouseCellPosition)
            {
                CurrentUnderCell = MouseCellPosition;
                TileBase tileBase;
                if (activeTileAssetName == "忽略")
                {
                    tileBase = GameDataCentre.GetRandomTileAssetDict("border");
                }
                else
                {
                    tileBase = GameDataCentre.GetRandomTileAssetDict(activeTileAssetName);
                }

                if (tileBase == null)
                {
                    Debug.LogWarning("TileAsset border didn't load");
                    return;
                }
                infoTileMap.DrawHexMeshTileCells(HexTileMetrics.GetCellInRange(CurrentUnderCell, brushSize).ToVector3Int(), tileBase);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 检查到鼠标左键点击单元格是编辑单元格
        /// </summary>
        private void EditCell(Vector2Int cellPosition)
        {
            TileBase cell = tilemapBackground.GetTile(cellPosition.ToVector3Int());

            if (cell != null)
            {
                EditCell(HexTileMetrics.GetCellInRange(cellPosition, brushSize));
                //Debug.Log($"get cell {cell.name}");
            }
        }