Exemplo n.º 1
0
    public void TryHover(Vector3 mousePosition)
    {
        Vector3Int cellLocation = terrainTileMap.WorldToCell(mousePosition);

        WorldTile currentTile;

        if (tiles.TryGetValue(cellLocation, out currentTile))
        {
            if (hovoredTile != null)
            {
                hovoredTile.Dehighlight();
                hovoredTile = null;
            }

            if (currentTile.IsPassable())
            {
                hovoredTile = currentTile;
                hovoredTile.Highlight(highlightTile);
            }
        }
    }