Beispiel #1
0
    void SelectOneUnder(Vector3 screenPos)
    {
        var selectableObject = GetComponentUnder(screenPos);

        if (selectableObject != null)
        {
            Select(selectableObject);
        }

        OnNewSelection?.Invoke(selectedObjects);
    }
Beispiel #2
0
    void SelectAllInBounds()
    {
        foreach (T selectableObject in FindObjectsOfType <T>())
        {
            if (IsWithinSelectionBounds(selectableObject.gameObject))
            {
                Select(selectableObject);
            }
        }

        OnNewSelection?.Invoke(selectedObjects);
    }
Beispiel #3
0
        /// <summary>
        /// Object that be focused.
        /// Invokes event for new or changed selections.
        /// </summary>
        /// <param name="newSelection">Focused GameObject</param>
        public void AddSelection(GameObject newSelection)
        {
            m_currentSelection = newSelection;

            if (m_currentSelection != m_previousSelection)
            {
                m_previousSelection = m_currentSelection;
                OnSelectionChanged?.Invoke(m_currentSelection);
            }

            OnNewSelection?.Invoke(newSelection);
        }