/*--------------------------------------------------------------------------------------------*/
        private void BuildCursor(HoverCursorDataProvider pProv, ICursorData pData)
        {
            var curGo = new GameObject(pData.Type + "");

            curGo.transform.SetParent(gameObject.transform, false);

            TreeUpdater treeUp = curGo.AddComponent <TreeUpdater>();

            HoverCursorFollower follow = curGo.AddComponent <HoverCursorFollower>();

            follow.CursorDataProvider   = pProv;
            follow.CursorType           = pData.Type;
            follow.FollowCursorActive   = false;
            follow.ScaleUsingCursorSize = true;

            HoverCursorRendererUpdater cursRendUp = curGo.AddComponent <HoverCursorRendererUpdater>();

            cursRendUp.CursorRendererPrefab = CursorRendererPrefab;

            if (pData.Idle != null)
            {
                HoverIdleRendererUpdater idleRendUp = curGo.AddComponent <HoverIdleRendererUpdater>();
                idleRendUp.IdleRendererPrefab = IdleRendererPrefab;
            }

            follow.Update();                    //moves interface to the correct cursor transform
            treeUp.UpdateAtAndBelowThisLevel(); //force renderer creation
        }
Exemple #2
0
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateRenderer(HoverCursorFollower pFollower)
        {
            ICursorData    cursorData = pFollower.GetCursorData();
            HoverIndicator cursorInd  = CursorRenderer.GetIndicator();

            CursorRenderer.Controllers.Set(SettingsControllerMap.GameObjectActiveSelf, this);
            CursorRenderer.Controllers.Set(HoverRendererCursor.IsRaycastName, this);
            CursorRenderer.Controllers.Set(HoverRendererCursor.ShowRaycastLineName, this);
            CursorRenderer.Controllers.Set(HoverRendererCursor.RaycastWorldOriginName, this);
            cursorInd.Controllers.Set(HoverIndicator.HighlightProgressName, this);
            cursorInd.Controllers.Set(HoverIndicator.SelectionProgressName, this);

            RendererUtil.SetActiveWithUpdate(CursorRenderer,
                                             (cursorData.IsActive && cursorData.Capability != CursorCapabilityType.None));
            CursorRenderer.IsRaycast       = cursorData.IsRaycast;
            CursorRenderer.ShowRaycastLine = (cursorData.CanCauseSelections &&
                                              cursorData.Type != CursorType.Look);
            CursorRenderer.RaycastWorldOrigin = cursorData.WorldPosition;
            cursorInd.HighlightProgress       = cursorData.MaxItemHighlightProgress;
            cursorInd.SelectionProgress       = cursorData.MaxItemSelectionProgress;
        }