Exemplo n.º 1
0
        public void HighlightPositions(IEnumerable <Vector2> positions, HighlightLevel level, MapDimensions dimensions)
        {
            var worldPositions =
                positions.Select(pos => dimensions.GetWorldPositionForGridPosition(pos)).ToList();

            var highlights = worldPositions.Select(pos => CreateHighlight(pos, level)).ToHashSet();

            _highlightsByLevel[level] = highlights;
        }
Exemplo n.º 2
0
                           2)));                                 // sets easing to quadratic

        /// <summary>
        /// Gets the highlight tint.
        /// </summary>
        /// <returns>The highlight tint.</returns>
        /// <param name="level">Highlight level.</param>
        public Color GetHighlightTint(HighlightLevel level)
        {
            switch (level)
            {
            case HighlightLevel.Bright:
                return(_materials[SectorTexture.Alcuin][SectorMaterialType.Bright].GetColor("_Color"));

            case HighlightLevel.Dimmed:
                return(_materials[SectorTexture.Alcuin][SectorMaterialType.Dimmed].GetColor("_Color"));

            default:
                throw new ArgumentException();
            }
        }
Exemplo n.º 3
0
        public void ClearHighlightedPositions(HighlightLevel level)
        {
            if (!_highlightsByLevel.ContainsKey(level))
            {
                return;
            }

            foreach (var highlight in _highlightsByLevel[level])
            {
                Destroy(highlight);
            }

            _highlightsByLevel.Remove(level);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sets the highlight tint.
        /// </summary>
        /// <param name="level">Highlight level.</param>
        /// <param name="tint">The tint.</param>
        public void SetHighlightTint(HighlightLevel level, Color tint)
        {
            switch (level)
            {
            case HighlightLevel.Bright:
                foreach (var mat in _materials.Values)
                {
                    mat[SectorMaterialType.Bright].SetColor("_Color", tint);
                }
                break;

            case HighlightLevel.Dimmed:
                foreach (var mat in _materials.Values)
                {
                    mat[SectorMaterialType.Dimmed].SetColor("_Color", tint);
                }
                break;
            }
        }
Exemplo n.º 5
0
        private GameObject CreateHighlight(Vector3 pos, HighlightLevel level)
        {
            var highlight = Instantiate(MapHighlightPrefab);

            highlight.transform.position = pos;
            highlight.transform.SetParent(transform);

            var highlightRenderer = highlight.GetComponent <Renderer>();

            highlightRenderer.sortingLayerName = "Default";
            highlightRenderer.sortingOrder     = BaseSortOrder + (int)level;

            switch (level)
            {
            case HighlightLevel.PlayerMove:
                highlightRenderer.material = MovementSelectionMaterial;
                break;

            case HighlightLevel.PlayerAttack:
                highlightRenderer.material = AttackSelectionMaterial;
                break;

            case HighlightLevel.PlayerHover:
                highlightRenderer.material = HoverSelectionMaterial;
                break;

            case HighlightLevel.SpecificEnemyMove:
                highlightRenderer.material = SpecificEnemyMaterial;
                break;

            case HighlightLevel.PlayerInteract:
                highlightRenderer.material = InteractMaterial;
                break;

            case HighlightLevel.GlobalEnemyMove:
                highlightRenderer.material = GlobalEnemyMaterial;
                break;
            }

            return(highlight);
        }
Exemplo n.º 6
0
 public MapHighlights(HashSet <Vector2> positions, HighlightLevel level)
 {
     Positions = positions;
     Level     = level;
 }
Exemplo n.º 7
0
 public void OnClearHighlight(HighlightLevel level)
 {
     View.ClearHighlightedPositions(level);
 }