コード例 #1
0
    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);
        }
    }
コード例 #2
0
    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();
    }
コード例 #3
0
 public void StopOveringOnDisplay()
 {
     if (_spriteRenderer)
     {
         HighlightService.StopHighlight(_spriteRenderer);
     }
 }
コード例 #4
0
    protected override void OnEndSurvey(bool wasCompleted)
    {
        var sprRenderer = _hoveredEntity.Get()?.GetComponentInChildren <SpriteRenderer>();

        if (sprRenderer)
        {
            HighlightService.StopHighlight(sprRenderer);
        }

        CursorOverlayService.Instance.ResetCursorToDefault();
        _selectedEntity = null;
    }