private void SetHighlighted(bool highlighted)
    {
        if (_highlighted == highlighted)
        {
            return;
        }

        _highlighted = highlighted;

        if (highlighted)
        {
            HighlightService.Params args = HighlightService.Params.Default;

            args.Duration     = HighlightService.Duration.UntilManuallyStopped;
            args.FlickerSpeed = HighlightService.FlickerSpeed.Slow;
            args.Intensity    = HighlightService.Intensity.Normal;
            args.AnimStart    = HighlightService.AnimStart.MidHighlight;

            HighlightService.HighlightSprite(_spriteRenderer, args);
        }
        else
        {
            HighlightService.StopHighlight(_spriteRenderer);
        }
    }
    private void Update()
    {
        _hoveredEntity.Set(FindHoveredEntity());

        if (Input.GetMouseButtonDown(0) && _hoveredEntity.Get() != null)
        {
            _selectedEntity = _hoveredEntity.Get().SimEntity;
            _hoveredEntity.Set(null);
        }

        // update higlight
        if (_hoveredEntity.ClearDirty())
        {
            if (_hoveredEntity.GetPrevious())
            {
                var sprRenderer = _hoveredEntity.GetPrevious().GetComponentInChildren <SpriteRenderer>();
                if (sprRenderer)
                {
                    HighlightService.StopHighlight(sprRenderer);
                }
            }

            if (_hoveredEntity.Get())
            {
                var sprRenderer = _hoveredEntity.Get().GetComponentInChildren <SpriteRenderer>();
                if (sprRenderer)
                {
                    HighlightService.HighlightSprite(sprRenderer, _highlightSettings);
                }
            }
        }

        UpdateRangeFeedback();
    }
    public void StartOveringOnDisplay()
    {
        if (_spriteRenderer)
        {
            var highlightParams = HighlightService.Params.Default;
            highlightParams.Color        = _overingHighlightColor;
            highlightParams.FlickerSpeed = HighlightService.FlickerSpeed.Fast;
            highlightParams.Intensity    = HighlightService.Intensity.High;

            HighlightService.HighlightSprite(_spriteRenderer, highlightParams);
        }
    }
예제 #4
0
    public override void OnPostSimulationTick()
    {
        base.OnPostSimulationTick();

        // On player's new turn
        if (Cache.DEPRECATED_IsNewTurn && Cache.DEPRECATED_CanLocalPlayerPlay)
        {
            // Find local pawn's doodle
            if (Cache.LocalPawn != Entity.Null &&
                BindedSimEntityManaged.InstancesMap.TryGetValue(Cache.LocalPawn, out GameObject localPawnViewGO))
            {
                if (localPawnViewGO.TryGetComponent(out DoodleDisplay doodleDisplay))
                {
                    var highlightParams = HighlightService.Params.Default;
                    highlightParams.Color        = _newTurnHighlightColor;
                    highlightParams.FlickerSpeed = HighlightService.FlickerSpeed.Fast;
                    highlightParams.Intensity    = HighlightService.Intensity.High;

                    HighlightService.HighlightSprite(doodleDisplay.SpriteRenderer, highlightParams);
                }
            }
        }
    }