public virtual void HandleChangeSelected(bool useInputDirection = true)
    {
        if (selectables.Length == 0 || inControlMode || (currentInputField != null && !currentInputField.readOnly))
        {
            return;
        }
        _Selectable[] otherSelectables = new _Selectable[0];
        otherSelectables = otherSelectables.AddRange(selectables);
        otherSelectables = otherSelectables.Remove(currentSelected);
        if (otherSelectables.Length == 0)
        {
            return;
        }
        float       selectableAttractiveness;
        _Selectable nextSelected = otherSelectables[0];
        float       highestSelectableAttractiveness = GetAttractivenessOfSelectable(nextSelected, useInputDirection);

        for (int i = 1; i < otherSelectables.Length; i++)
        {
            _Selectable selectable = otherSelectables[i];
            selectableAttractiveness = GetAttractivenessOfSelectable(selectable, useInputDirection);
            if (selectableAttractiveness > highestSelectableAttractiveness)
            {
                highestSelectableAttractiveness = selectableAttractiveness;
                nextSelected = selectable;
            }
        }
        ChangeSelected(nextSelected);
    }
    public virtual void ColorSelected(_Selectable selectable, float colorMultiplier)
    {
        ColorBlock colors = selectable.selectable.colors;

        colors.colorMultiplier       = colorMultiplier;
        selectable.selectable.colors = colors;
    }
    public virtual float GetAttractivenessOfSelectable(_Selectable selectable, bool useInputDirection = true)
    {
        float attractiveness = selectable.priority;

        if (useInputDirection)
        {
            Vector2 directionToSelectable  = GetDirectionToSelectable(selectable);
            float   angleAttractiveness    = (180f - Vector2.Angle(inputDirection, directionToSelectable)) * angleEffectiveness;
            float   distanceAttractiveness = directionToSelectable.magnitude * distanceEffectiveness;
            attractiveness += angleAttractiveness - distanceAttractiveness;
        }
        return(attractiveness);
    }
 public virtual void ChangeSelected(_Selectable selectable)
 {
     if (inControlMode)
     {
         return;
     }
     if (currentSelected != null)
     {
         ColorSelected(currentSelected, 1);
     }
     currentSelected = selectable;
     currentSelected.selectable.Select();
     colorMultiplier.JumpToStart();
 }
 public virtual bool IsMousedOverSelectable(_Selectable selectable)
 {
     return(IsMousedOverRectTransform(selectable.rectTrs, selectable.canvas, selectable.canvasRectTrs));
 }
 public virtual bool CanSelectSelectable(_Selectable selectable)
 {
     return(selectables.Contains(selectable) && selectable.selectable.IsInteractable() && selectable.canvas.enabled);
 }
 public virtual Vector2 GetDirectionToSelectable(_Selectable selectable)
 {
     return(selectable.rectTrs.GetCenterInCanvasNormalized(selectable.canvasRectTrs) - currentSelected.rectTrs.GetCenterInCanvasNormalized(currentSelected.canvasRectTrs));
 }
 public virtual void RemoveSelectable(_Selectable selectable)
 {
     selectables = selectables.Remove(selectable);
 }
 public virtual void AddSelectable(_Selectable selectable)
 {
     selectables = selectables.Add(selectable);
 }