コード例 #1
0
 public static Cell FromTileDataSo(TileDataSo so, int2 pos, byte tileRefIndex)
 {
     return(new Cell
     {
         pos = pos,
         tileRefIndex = tileRefIndex,
         walkSpeed = so.walkSpeed,
         canGrow = so.canGrow,
         canBuild = so.canBuild
     });
 }
コード例 #2
0
        private void Update()
        {
            if (highlightTileCell && Input.GetMouseButtonDown(0))
            {
                //are we on map
                Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

                Cell c = GridSystem.GETCell(mousePos);

                if (!c.IsDefault())
                {
                    Debug.LogWarning(c.Print());
                }
                else
                {
                    Debug.LogWarning($"Didn't get cell MousePos: {mousePos}, {c.pos}");
                }
            }


            if (onClickPrintTileData)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

                    Vector3Int gridpos = tilemap.WorldToCell(mousePos);

                    TileBase tile = tilemap.GetTile(gridpos);

                    TileDataSo data = mapData.tileRefList.GETData(tile);

                    if (data != null)
                    {
                        Debug.LogWarning($"TileData: {data.name}, Walkable: {data.walkSpeed}, Pos: {gridpos}");
                    }
                    else
                    {
                        Debug.LogWarning($"No Tile found pos: {gridpos}");
                    }
                }
            }
        }