示例#1
0
    private void HoverTile(GridTile tile, bool isHovered)
    {
        if (tile != null)
        {
            tile.isHovered = isHovered;
            Color blockColor = isHovered ? hoverColor : (tile.IsSelected ? selectedColor : tile.CurrentTileStateColor);
            tile.SetAlbedoColor(blockColor);

            Color?ghostColor = isHovered ? (hoverColor as Color?) : null;
            tile.ChangeHoverGhostColor(ghostColor);
        }
    }
示例#2
0
    private void HighlightGhostTiles(RaycastHit hit)
    {
        if (Input.GetMouseButton(MouseButtons.LEFT))
        {
            List <GameObject> selectedObjects = SelectObjectsAlgorithm(hit);

            for (int i = 0; i < selectedObjects.Count; i++)
            {
                GridTile currentTile = gridTiles.Find(tile => tile.ghostTile == selectedObjects[i]);
                if (currentTile != null)
                {
                    currentTile.TryShowGhost();
                    currentTile.ChangeHoverGhostColor(hoverColor);
                    if (!lastHighlightedGhostTiles.Contains(currentTile))
                    {
                        lastHighlightedGhostTiles.Add(currentTile);
                    }
                }
            }
        }
    }