コード例 #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(ProjectionState pProjectionState,
                                  IProjectionVisualSettings pSettings)
        {
            vProjectionState = pProjectionState;
            vSettings        = (ProjectionVisualSettingsStandard)pSettings;

            ////

            vSpotObj = new GameObject("Spot");
            vSpotObj.transform.SetParent(gameObject.transform, false);
            vSpotObj.transform.localScale = Vector3.zero;

            MeshFilter spotFilt = vSpotObj.AddComponent <MeshFilter>();

            MeshUtil.BuildCircleMesh(spotFilt.mesh, 0.5f, 32);
            vSpotMesh = spotFilt.mesh;

            MeshRenderer spotRend = vSpotObj.AddComponent <MeshRenderer>();

            spotRend.sharedMaterial =
                Materials.GetLayer(Materials.Layer.AboveText, Materials.DepthHintMax);

            ////

            vLineObj      = GameObject.CreatePrimitive(PrimitiveType.Cube);
            vLineObj.name = "Line";
            vLineObj.transform.SetParent(gameObject.transform, false);
            vLineObj.transform.localScale = Vector3.zero;
            vLineMesh = vLineObj.GetComponent <MeshFilter>().mesh;

            MeshRenderer lineRend = vLineObj.GetComponent <MeshRenderer>();

            lineRend.sharedMaterial =
                Materials.GetLayer(Materials.Layer.AboveText, Materials.DepthHintMax);
        }
コード例 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Build(ProjectionState pProjectionState, IProjectionVisualSettings pSettings)
        {
            vProjectionState = pProjectionState;
            vSettings        = (ProjectionVisualSettingsStandard)pSettings;

            ////

            vSpotObj = new GameObject("Spot");
            vSpotObj.transform.SetParent(gameObject.transform, false);
            vSpotObj.transform.localScale = Vector3.zero;

            MeshFilter spotMeshFilt = vSpotObj.AddComponent <MeshFilter>();

            MeshUtil.BuildCircleMesh(spotMeshFilt.mesh, 0.5f, 32);

            MeshRenderer spotMeshRend = vSpotObj.AddComponent <MeshRenderer>();

            spotMeshRend.sharedMaterial              = new Material(Shader.Find("Unlit/AlphaSelfIllum"));
            spotMeshRend.sharedMaterial.renderQueue += 100;

            ////

            vLineObj      = GameObject.CreatePrimitive(PrimitiveType.Cube);
            vLineObj.name = "Line";
            vLineObj.transform.SetParent(gameObject.transform, false);
            vLineObj.transform.localScale                 = Vector3.zero;
            vLineObj.renderer.sharedMaterial              = new Material(Shader.Find("Unlit/AlphaSelfIllum"));
            vLineObj.renderer.sharedMaterial.renderQueue += 200;
        }
コード例 #3
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(ProjectionState pProjectionState,
																IProjectionVisualSettings pSettings)
        {
            vProjectionState = pProjectionState;
            vSettings = (ProjectionVisualSettingsStandard)pSettings;

            ////

            vSpotObj = new GameObject("Spot");
            vSpotObj.transform.SetParent(gameObject.transform, false);
            vSpotObj.transform.localScale = Vector3.zero;

            MeshFilter spotFilt = vSpotObj.AddComponent<MeshFilter>();
            MeshUtil.BuildCircleMesh(spotFilt.mesh, 0.5f, 32);
            vSpotMesh = spotFilt.mesh;

            MeshRenderer spotRend = vSpotObj.AddComponent<MeshRenderer>();
            spotRend.sharedMaterial =
                Materials.GetLayer(Materials.Layer.AboveText, Materials.DepthHintMax);

            ////

            vLineObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
            vLineObj.name = "Line";
            vLineObj.transform.SetParent(gameObject.transform, false);
            vLineObj.transform.localScale = Vector3.zero;
            vLineMesh = vLineObj.GetComponent<MeshFilter>().mesh;

            MeshRenderer lineRend = vLineObj.GetComponent<MeshRenderer>();
            lineRend.sharedMaterial =
                Materials.GetLayer(Materials.Layer.AboveText, Materials.DepthHintMax);
        }
コード例 #4
0
        /*--------------------------------------------------------------------------------------------*/
        public void Update()
        {
            vState.UpdateAfterInput();

            for (int i = 0; i < vState.Panels.Count; i++)
            {
                IItemPanel itemPanel = vState.Panels[i].ItemPanel;
                ((GameObject)itemPanel.DisplayContainer).SetActive(itemPanel.IsVisible);
            }

            ////

            InteractionSettings interSett = InteractionSettings.GetSettings();

            if (interSett.ApplyScaleMultiplier)
            {
                Vector3 worldUp = transform.TransformVector(Vector3.up);
                interSett.ScaleMultiplier = 1 / worldUp.magnitude;
            }
            else
            {
                interSett.ScaleMultiplier = 1;
            }

            ////

            IList <CursorType>        activeCursorTypes = interSett.Cursors;
            IProjectionVisualSettings projSett          = ProjectionVisualSettings.GetSettings();

            CursorTypeUtil.Exclude(vPrevActiveCursorTypes, activeCursorTypes, vHideCursorTypes);
            CursorTypeUtil.Exclude(activeCursorTypes, vPrevActiveCursorTypes, vShowCursorTypes);

            foreach (CursorType cursorType in vHideCursorTypes)
            {
                vProjMap[cursorType].gameObject.SetActive(false);
                vState.ActivateProjection(cursorType, false);
            }

            foreach (CursorType cursorType in vShowCursorTypes)
            {
                if (vProjMap.ContainsKey(cursorType))
                {
                    vProjMap[cursorType].gameObject.SetActive(true);
                    vState.ActivateProjection(cursorType, true);
                    continue;
                }

                var projObj = new GameObject("Proj-" + cursorType);
                projObj.transform.SetParent(gameObject.transform, false);
                UiProjection uiProj = projObj.AddComponent <UiProjection>();
                uiProj.Build(vState.GetProjection(cursorType), projSett);

                vProjMap.Add(cursorType, uiProj);
            }

            vPrevActiveCursorTypes.Clear();
            vPrevActiveCursorTypes.AddRange(activeCursorTypes);
        }
コード例 #5
0
        /*--------------------------------------------------------------------------------------------*/
        public void Update()
        {
            vState.UpdateAfterInput();

            foreach (PanelState panelState in vState.Panels)
            {
                ItemPanel itemPanel = panelState.ItemPanel;
                ((GameObject)itemPanel.DisplayContainer).SetActive(itemPanel.IsVisible);
            }

            ////

            InteractionSettings interSett = InteractionSettings.GetSettings();

            if (interSett.ApplyScaleMultiplier)
            {
                Vector3 worldUp = transform.TransformVector(Vector3.up);
                interSett.ScaleMultiplier = 1 / worldUp.magnitude;
            }
            else
            {
                interSett.ScaleMultiplier = 1;
            }

            ////

            CursorType[]              activeCursorTypes = interSett.Cursors;
            IEnumerable <CursorType>  hideCursorTypes   = vPrevActiveCursorTypes.Except(activeCursorTypes);
            IEnumerable <CursorType>  showCursorTypes   = activeCursorTypes.Except(vPrevActiveCursorTypes);
            IProjectionVisualSettings projSett          = ProjectionVisualSettings.GetSettings();

            foreach (CursorType cursorType in hideCursorTypes)
            {
                vProjMap[cursorType].gameObject.SetActive(false);
                vState.ActivateProjection(cursorType, false);
            }

            foreach (CursorType cursorType in showCursorTypes)
            {
                if (vProjMap.ContainsKey(cursorType))
                {
                    vProjMap[cursorType].gameObject.SetActive(true);
                    vState.ActivateProjection(cursorType, true);
                    continue;
                }

                var projObj = new GameObject("Proj-" + cursorType);
                projObj.transform.SetParent(gameObject.transform, false);
                UiProjection uiProj = projObj.AddComponent <UiProjection>();
                uiProj.Build(vState.GetProjection(cursorType), projSett);

                vProjMap.Add(cursorType, uiProj);
            }

            vPrevActiveCursorTypes = activeCursorTypes;
        }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		public IProjectionVisualSettings GetSettings() {
			if ( vSettings != null ) {
				return vSettings;
			}

			IProjectionVisualSettings sett = GetSettingsInner();

			CustomUtil.VerifyRenderer<IUiProjectionRenderer>(
				sett.Renderer, null, "Hoverboard", "Projection");

			vSettings = sett;
			return sett;
		}
コード例 #7
0
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		internal void Build(ProjectionState pProjectionState, IProjectionVisualSettings pSettings) {
			vProjectionState = pProjectionState;
			vSettings = pSettings;

			////

			vRendererHold = new GameObject("ProjectionRendererHold");
			vRendererHold.transform.SetParent(gameObject.transform, false);

			vRendererObj = new GameObject("ProjectionRenderer");
			vRendererObj.transform.SetParent(vRendererHold.transform, false);

			vRenderer = (IUiProjectionRenderer)vRendererObj.AddComponent(vSettings.Renderer);
			vRenderer.Build(vProjectionState, vSettings);
		}
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public IProjectionVisualSettings GetSettings()
        {
            if (vSettings != null)
            {
                return(vSettings);
            }

            IProjectionVisualSettings sett = GetSettingsInner();

            CustomUtil.VerifyRenderer <IUiProjectionRenderer>(
                sett.Renderer, null, "Hoverboard", "Projection");

            vSettings = sett;
            return(sett);
        }
コード例 #9
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        internal void Build(ProjectionState pProjectionState, IProjectionVisualSettings pSettings)
        {
            vProjectionState = pProjectionState;
            vSettings        = pSettings;

            ////

            vRendererHold = new GameObject("ProjectionRendererHold");
            vRendererHold.transform.SetParent(gameObject.transform, false);

            vRendererObj = new GameObject("ProjectionRenderer");
            vRendererObj.transform.SetParent(vRendererHold.transform, false);

            vRenderer = (IUiProjectionRenderer)vRendererObj.AddComponent(vSettings.Renderer);
            vRenderer.Build(vProjectionState, vSettings);
        }