/*--------------------------------------------------------------------------------------------*/
        private void FillCursorLists()
        {
            for (int i = 0; i < vItems.Count; i++)
            {
                HoverItemData           data       = vItems[i].Data;
                IItemDataSelectable     selData    = (IItemDataSelectable)data;
                HoverItemHighlightState highState  = data.GetComponent <HoverItemHighlightState>();
                ICursorData             cursorData = highState.NearestHighlight.Value.Cursor;

                if (cursorData.Idle.Progress >= 1)
                {
                    selData.DeselectStickySelections();
                    continue;
                }

                HoverItemSelectionState selState = data.GetComponent <HoverItemSelectionState>();
                HoverRenderer           rend     = data.GetComponent <HoverItemRendererUpdater>().ActiveRenderer;

                var info = new StickySelectionInfo {
                    ItemWorldPosition = rend.GetCenterWorldPosition(),
                    SelectionProgress = selState.SelectionProgress
                };

                cursorData.ActiveStickySelections.Add(info);
            }
        }
Esempio n. 2
0
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateItems()
        {
            List <ICursorData> cursors = CursorDataProvider.Cursors;
            int cursorCount            = cursors.Count;

            for (int i = 0; i < cursorCount; i++)
            {
                ICursorData cursor = cursors[i];
                cursor.MaxItemHighlightProgress = 0;
                cursor.MaxItemSelectionProgress = 0;

                if (!cursor.CanCauseSelections)
                {
                    continue;
                }

                HoverItemHighlightState highState = FindNearestItemWithinProxOfCursor(
                    cursor.Type, out HoverItemHighlightState.Highlight? high);

                if (highState == null || high == null)
                {
                    continue;
                }

                highState.SetNearestAcrossAllItemsForCursor(cursor.Type);
                cursor.MaxItemHighlightProgress = high.Value.Progress;
            }

            for (int i = 0; i < vActiveHighStates.Count; i++)
            {
                HoverItemHighlightState highState = vActiveHighStates[i];
                HoverItemSelectionState selState  = highState.GetComponent <HoverItemSelectionState>();

                highState.UpdateViaManager();

                if (selState == null)
                {
                    continue;
                }

                selState.UpdateViaManager();

                if (selState.WasSelectedThisFrame)
                {
                    ICursorData selCursor = highState.NearestHighlight?.Cursor;
                    //Debug.Log("Item selected: "+selState.transform.ToDebugPath()+" / "+
                    //	selCursor?.Type, selState);
                    OnItemSelected.Invoke(highState.GetComponent <HoverItem>(), selCursor);
                }
            }
        }