当前位置: 首页>>代码示例>>C#>>正文


C# SceneView类代码示例

本文整理汇总了C#中SceneView的典型用法代码示例。如果您正苦于以下问题:C# SceneView类的具体用法?C# SceneView怎么用?C# SceneView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SceneView类属于命名空间,在下文中一共展示了SceneView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

    public static void Update(SceneView sv)
    {
        Event e = Event.current;

        if (e == null)
        {
            return;
        }

        if (e.type == EventType.keyDown)
        {
            switch(e.keyCode)
            {
                case KeyCode.L:

                    GrendelEditorPreferences.DrawEditorObjectLabels = !GrendelEditorPreferences.DrawEditorObjectLabels;

                break;

                case KeyCode.End:

                    MoveObjectToGround.Move(Selection.activeGameObject);

                break;
            }
        }
    }
开发者ID:ekhudson,项目名称:old-Grendel,代码行数:27,代码来源:EditorInput.cs

示例2: OnSceneInteract

	static void OnSceneInteract(SceneView sceneView)
	{
		Event e = Event.current;
		
		if (isActive)
		{
			Vector2 mousePos = Event.current.mousePosition;
			mousePos.y = sceneView.camera.pixelHeight - mousePos.y;
			Vector3 position = sceneView.camera.ScreenPointToRay(mousePos).origin;
			Vector3 roundedPosition = new Vector3(Mathf.Round((position.x / SIZE_X) * SIZE_X), Mathf.Round((position.y / SIZE_Y) * SIZE_Y), 0);
			if (e.type == EventType.MouseDown && e.button == 0)
			{
				if (Selection.activeGameObject && Selection.activeGameObject.tag == "Tile")
					LastTile = Selection.activeGameObject;
				if (LastTile)
				{	
					GameObject tile = Instantiate(LastTile, roundedPosition, Quaternion.identity) as GameObject;
					tile.name = LastTile.name;
				}
			}
			else if (e.type == EventType.MouseDown && e.button == 1)
			{
				GameObject[] tiles = GameObject.FindGameObjectsWithTag("Tile");
				foreach (GameObject tile in tiles)
				{
					if (tile.transform.position == roundedPosition)
						DestroyImmediate(tile);
				}
			}
		}
	}
开发者ID:Julow,项目名称:unity_pool,代码行数:31,代码来源:MapEditor.cs

示例3: OnSceneGui

 private void OnSceneGui(SceneView s)
 {
     if (lastObj != null)
     {
         lastObj.OnSceneGui(s);
     }
 }
开发者ID:friuns,项目名称:New-Unity-Project-tm2---Copy,代码行数:7,代码来源:Tools3.cs

示例4: CreatePointAsync

 /// <summary>
 /// Create a new point. This will activate drawing experience on the map. To complete it, select location from the map.
 /// </summary>
 /// <param name="sceneView">The <see cref="SceneView"/> that is used for drawing.</param>
 /// <exception cref="TaskCanceledException">If previous task wasn't completed, <see cref="TaskCanceledException"/>
 /// will be thrown. The task is cancelled if <see cref="Cancel"/> method or if any other draw or edit method is called.
 /// </exception>
 /// <returns>Return new <see cref="MapPoint"/> based on the user interactions.</returns>
 public static async Task<MapPoint> CreatePointAsync(SceneView sceneView)
 {
     Initialize();
     var geometry = await SceneDrawHelper.DrawPointAsync(sceneView, _drawTaskTokenSource.Token);
     Cleanup();
     return geometry;
 }
开发者ID:Esri,项目名称:arcgis-runtime-demos-dotnet,代码行数:15,代码来源:SceneEditHelper.cs

示例5: GridUpdate

    void GridUpdate(SceneView sceneview)
    {
        e = Event.current;

        //Make sure MapData has been loaded
        _MapData = EditorHelper.CheckMapData(_MapData);

        //If a Grid exists place tiles
        if (EditorHelper.GridExsists())
        {
            if(grid == null)
            {
                grid = GameObject.FindObjectOfType<DrawGrid>();
            }

            if (EditorHelper.InsideGrid(EditorHelper.GetMousePosition(e)))
            {
                //if input is from a mouse and the mouse button was a left click event
                if (e.button == 0 && e.isMouse && e.type == EventType.MouseDown)
                {
                    PaintTile();
                }
            }
        }
    }
开发者ID:DanWeston626,项目名称:LevelEditor,代码行数:25,代码来源:GridEditorSceneView.cs

示例6: OnScene

	static void OnScene(SceneView sceneview)
	{
		var targets = GameObject.FindObjectsOfType<SimpleCCD>();

		foreach (var target in targets)
		{
			foreach (var node in target.angleLimits)
			{
				if (node.Transform == null)
					continue;

				Transform transform = node.Transform;
				Vector3 position = transform.position;

				float handleSize = HandleUtility.GetHandleSize(position);
				float discSize = handleSize * gizmoSize;


				float parentRotation = transform.parent ? transform.parent.eulerAngles.z : 0;
				Vector3 min = Quaternion.Euler(0, 0, node.min + parentRotation)*Vector3.down;
				Vector3 max = Quaternion.Euler(0, 0, node.max + parentRotation)*Vector3.down;

				Handles.color = new Color(0, 1, 0, 0.1f);
				Handles.DrawWireDisc(position, Vector3.back, discSize);
				Handles.DrawSolidArc(position, Vector3.forward, min, node.max - node.min, discSize);

				Handles.color = Color.green;
				Handles.DrawLine(position, position + min * discSize);
				Handles.DrawLine(position, position + max*discSize);

				Vector3 toChild = FindChildNode(transform, target.endTransform).position - position;
				Handles.DrawLine(position, position + toChild);
			}
		}
	}
开发者ID:Sushiy,项目名称:ShamanDance,代码行数:35,代码来源:SimpleCCDEditor.cs

示例7: GridUpdate

    void GridUpdate(SceneView sceneView)
    {
        Event e = Event.current;

        Ray r = Camera.current.ScreenPointToRay(new Vector3(e.mousePosition.x, -e.mousePosition.y + Camera.current.pixelHeight));
        Vector3 mousePosition = r.origin;

        if(e.isKey && e.character == 'a') {

            GameObject obj;

            Object prefab = PrefabUtility.GetPrefabParent(Selection.activeObject);

            if (prefab)
            {
                obj = (GameObject)PrefabUtility.InstantiatePrefab(prefab);

                Vector3 closestGridPoint = grid.grid[0,0];
                foreach(Vector3 point in grid.grid)
                {
                    if (Mathf.Abs(Vector3.Distance(point, mousePosition)) < Mathf.Abs(Vector3.Distance(closestGridPoint, mousePosition)))
                        closestGridPoint = point;
                }

                Vector3 alignedWithGrid = closestGridPoint;
                obj.transform.position = alignedWithGrid;
            }

        }
    }
开发者ID:alexwaslike,项目名称:TheLab,代码行数:30,代码来源:GridEditor.cs

示例8: SceneGUI

    void SceneGUI(SceneView sceneView)
    {
        Event e = Event.current;

        Handles.BeginGUI();

        switch (uiMode)
        {
            case UIMODE.MODE1:
                {
                    if (GUI.Button(new Rect(10, 10, 100, 50), "to MODE2"))
                        uiMode = UIMODE.MODE2;
                }
                break;
            case UIMODE.MODE2:
                {
                    if (GUI.Button(new Rect(10, 10, 100, 50), "to MODE1"))
                        uiMode = UIMODE.MODE1;

                    if (GUI.Button(new Rect(150, 10, 200, 50), "Show My Window"))
                    {
                        Debug.Log("Hello =====================");
                        isShow = !isShow;
                    }

                    if (isShow)
                        GUILayout.Window(0, new Rect(10, 90, 300, 300), ShowMyWindow, "Unity Objects");
                }
                break;
        }

        Handles.EndGUI();
    }
开发者ID:yelimlim,项目名称:UnityStudy,代码行数:33,代码来源:MyEditorWindow.cs

示例9: OnSceneGUI

 private void OnSceneGUI(SceneView scene)
 {
     
     UpdateOther(scene);
     UpdateSetCam(scene);                
     timer.Update();
 }
开发者ID:ConnectDeveloper01,项目名称:dorumon,代码行数:7,代码来源:InspectorSearch.cs

示例10: OnSceneGUI

 static void OnSceneGUI(SceneView scnView)
 {
     if (_toolbarEnabled)
     {
         GUI.Window(110, new Rect(0,16, 256, _buttonSize), ToolbarWindow,"", GUI.skin.label);
     }
 }
开发者ID:ekhudson,项目名称:old-Grendel,代码行数:7,代码来源:GrendelToolbar.cs

示例11: ToSceneView

        /// <summary>
        /// Returns SceneView representation more suitable for ray tracer.
        /// </summary>
        /// <param name="fov">Field of view in degrees.</param>
        /// <param name="aspectRatio">Width / height of the rectangle in space to render.</param>
        /// <returns></returns>
        public SceneView ToSceneView(double fov, double aspectRatio)
        {
            SceneView view = new SceneView();
            view.Origin = this.Origin;

            Vector lookVector = LookAt - Origin;

            double rectWidth = lookVector.Len / (double)60 * fov;
            double rectHeight = rectWidth / aspectRatio;

            // use UP vector to determine left vector
            view.RenderRectTopSide = new Vector(0, 1, 0).Cross(lookVector);
            view.RenderRectTopSide.Normalize();
            view.RenderRectTopSide.Mul(rectWidth);

            // top vector must be perpendicular to lookVector and left vector
            view.RenderRectLeftSide = view.RenderRectTopSide.Cross(lookVector);
            view.RenderRectLeftSide.Normalize();
            view.RenderRectLeftSide.Mul(-rectHeight);

            // render rect centered at LookAt
            view.RenderRectOrigin = LookAt;
            view.RenderRectOrigin -= view.RenderRectLeftSide / 2;
            view.RenderRectOrigin -= view.RenderRectTopSide / 2;

            double test = lookVector.Dot(view.RenderRectLeftSide);
            double test2 = lookVector.Dot(view.RenderRectTopSide);
            Debug.Assert(Math.Abs(test) < Constants.Epsilon && Math.Abs(test2) < Constants.Epsilon,
                "RenderRect not perpendicular to lookVector");

            return view;
        }
开发者ID:mkonicek,项目名称:raytracer,代码行数:38,代码来源:Camera.cs

示例12: OnSceneGUI

    void OnSceneGUI(SceneView sceneView)
    {
        Event e = Event.current;

        if (e.type == EventType.KeyDown)
        {
            switch (e.keyCode)
            {
                case KeyCode.PageUp:
                    selectedLayer = Wrap(--selectedLayer, layerNames.Length);
                    Selection.activeGameObject = tilemapGos[selectedLayer];
                    break;

                case KeyCode.PageDown:
                    selectedLayer = Wrap(++selectedLayer, layerNames.Length);
                    Selection.activeGameObject = tilemapGos[selectedLayer];
                    break;

                default:
                    break;
            }
            e.Use();
        }

        Handles.BeginGUI();

        selectedLayer = GUI.SelectionGrid(new Rect(0, 32, 128, 64), selectedLayer, layerNames, 1);

        if (fadeOtherLayers)
        {
            SetTileMapLayerColors();
        }

        Handles.EndGUI();
    }
开发者ID:CarlosMeloStuff,项目名称:UnityLibrary,代码行数:35,代码来源:TilemapLayerHelper.cs

示例13: OnSceneGui

    public override void OnSceneGui(SceneView sc)
    {
        #if UNITY_EDITOR
        bool spa = Event.current.keyCode == KeyCode.F1;
        bool bag = Event.current.keyCode == KeyCode.F2;
        if (Event.current.type == EventType.keyDown && (spa || bag))
        {
            RaycastHit h;
            var spw = GameObject.Find("dmSpawns");
            if (spw == null)
                spw = new GameObject("dmSpawns");

            Vector2 mousePosition = Event.current.mousePosition;
            mousePosition.y = Screen.height - mousePosition.y - 40;

            if (Physics.Raycast(sc.camera.ScreenPointToRay(mousePosition), out h))
            {
                GameObject a;
                if (bag)
                    a = (GameObject)PrefabUtility.InstantiatePrefab(resEditor.bag);
                else
                    a = new GameObject("Spawn");
                Undo.RegisterCreatedObjectUndo(a, "a");
                a.transform.position = h.point + Vector3.up * 1;
                a.transform.parent = spw.transform;
                if (spa)
                    a.AddComponent<Spawn>();
            }
        }
        #endif
    }
开发者ID:friuns,项目名称:New-Unity-Project-Eddy-Car-Phys,代码行数:31,代码来源:GameBots.cs

示例14: GridUpdate

    void GridUpdate(SceneView sceneview)
    {
        Event e = Event.current;

        Ray r = Camera.current.ScreenPointToRay(new Vector3(e.mousePosition.x, -e.mousePosition.y + Camera.current.pixelHeight));
        Vector3 mousePos = r.origin;

        if (e.isKey && e.character == 'a')
        {
            GameObject obj;
            Object prefab = PrefabUtility.GetPrefabParent(Selection.activeObject);

            if (prefab)
            {
                Undo.IncrementCurrentGroup();
                obj = (GameObject)PrefabUtility.InstantiatePrefab(prefab);
                blocks.Add(obj);
                Vector3 aligned = new Vector3(Mathf.Floor(mousePos.x / grid.width) * grid.width + grid.width / 2.0f,
                                  Mathf.Floor(mousePos.y / grid.height) * grid.height + grid.height / 2.0f, 0.0f);

                int blockOrientation = 0;
                for (int i = blocks.Count - 1; i >= 0; i--)
                {
                    if (blocks[i] == null || blocks[i].transform.position == aligned)
                    {
                        DestroyImmediate(blocks[i]);
                        blocks.RemoveAt(i);
                    }
                    Debug.Log("aligned=" + aligned + " Block Position=" + blocks[i].transform.position);
                }
                obj.transform.position = aligned;
                obj.transform.SetParent(GameObject.Find("Grid").transform);
                if (obj.tag == "Grass")
                {
                    grassBlocks.Add(obj);
                    for (int i = grassBlocks.Count - 1; i >= 0; i--)
                    {
                        blockOrientation = 15;
                        Vector3 up = new Vector3(grassBlocks[i].transform.position.x, grassBlocks[i].transform.position.y + 1.0f, 0.0f);
                        Vector3 down = new Vector3(grassBlocks[i].transform.position.x, grassBlocks[i].transform.position.y - 1.0f, 0.0f);
                        Vector3 left = new Vector3(grassBlocks[i].transform.position.x - 1.0f, grassBlocks[i].transform.position.y, 0.0f);
                        Vector3 right = new Vector3(grassBlocks[i].transform.position.x + 1.0f, grassBlocks[i].transform.position.y, 0.0f);
                        for (int j = grassBlocks.Count - 1; j >= 0; j--)
                        {
                            if (grassBlocks[j].transform.position == up) blockOrientation -= 1;
                            if (grassBlocks[j].transform.position == down) blockOrientation -= 2;
                            if (grassBlocks[j].transform.position == left) blockOrientation -= 4;
                            if (grassBlocks[j].transform.position == right) blockOrientation -= 8;
                            Debug.Log(" Block Orientation=" + blockOrientation);
                        }
                        Debug.Log(" Block sprite=" + i + " grassSprite= " + blockOrientation);
                        Debug.Log(" Blocks=" + grassBlocks.Count + " grass= " + grassSprites.Length);
                        grassBlocks[i].GetComponent<SpriteRenderer>().sprite = grassSprites[blockOrientation];
                    }
                }
                Undo.RegisterCreatedObjectUndo(obj, "Create " + obj.name);
            }
        }
    }
开发者ID:JeremyAstolfi,项目名称:MorningRitual,代码行数:59,代码来源:GridEditor.cs

示例15: OnSceneGUI

 public void OnSceneGUI(SceneView sceneView)
 {
     // Select objects with right mouse
     if (Event.current.type == EventType.mouseDown && Event.current.button == 0)
     {
         _ctrlKeyFlag = Event.current.control;
         MouseRightClickFlag = true;
         MousePosition = Event.current.mousePosition;
     }
 }
开发者ID:illvisation,项目名称:cellVIEW_bdbox,代码行数:10,代码来源:SelectionManager.cs


注:本文中的SceneView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。