本文整理汇总了C#中SceneView.Update方法的典型用法代码示例。如果您正苦于以下问题:C# SceneView.Update方法的具体用法?C# SceneView.Update怎么用?C# SceneView.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SceneView
的用法示例。
在下文中一共展示了SceneView.Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnUpdate
void OnUpdate(SceneView sceneView)
{
Vector2 screenpos = Event.current.mousePosition;
screenpos.y = sceneView.camera.pixelHeight - screenpos.y;
MousePos = sceneView.camera.ScreenPointToRay(screenpos).origin;
bool withinGrid = MousePos.isWithinGrid();
if (withinGrid)
{
if (Event.current.type == EventType.MouseDown && Event.current.button == 2)
{
Active = !Active;
Event.current.Use(); //keeping this line causes one bug, removing it causes another.
}
}
if (Active)
{
UpdateIndicator(withinGrid);
}
if(Active && withinGrid)
{
if (Event.current.type == EventType.layout)
HandleUtility.AddDefaultControl(GUIUtility.GetControlID(GetHashCode(), FocusType.Passive));
Selection.activeObject = null;
RightClick = isRightPressed(RightClick);
LeftClick = isLeftPressed(LeftClick);
Vector2 ScrollVect = getScroll();
int scroll = Math.Sign(ScrollVect.y);
if (scroll != 0)
{
int nextPiece = (int)selectedIndex + scroll;
if (nextPiece >= 0 && nextPiece < PieceTypeList.Count)
{
selectedIndex = nextPiece;
SetIndicator();
}
}
if (selectedPiece == typeof(Wall))
{
Side side;
Orientation or;
Vector2 target = Utils.WorldToWallPos(MousePos, out side, out or);
if (Indicator)
{
Indicator.transform.position = target;
Wall wall = Indicator.GetComponent<Wall>();
wall.orientation = or;
}
if (LeftDown())
{
SpawnWall(target, or, side);
sceneView.Update();
sceneView.Repaint();
}
else if (RightDown())
{
RoomManager.roomManager.RemoveWall(MousePos);
sceneView.Update();
sceneView.Repaint();
}
}
else if (selectedPiece == typeof(Player))
{
Cell target = Cell.GetFromWorldPos(MousePos);
if (target != null)
{
Indicator.transform.position = target.WorldPos();
if (LeftDown())
{
//SpawnPiece(selectedPiece, target);
SpawnPlayer(target);
sceneView.Update();
sceneView.Repaint();
}
else if (RightDown())
{
RoomManager.roomManager.RemoveTopPiece(target);
sceneView.Update();
sceneView.Repaint();
}
}
}
else if (selectedIndex != 0)//spawn any other piece (other than wall)
{
Cell target = Cell.GetFromWorldPos(MousePos);
if (target!=null) {
if (Indicator != null) Indicator.transform.position = target.WorldPos();
if (LeftDown())
{
SpawnPiece(selectedPiece, target);
sceneView.Update();
sceneView.Repaint();
}
else if (RightDown())
{
RoomManager.roomManager.RemoveTopPiece(target);
sceneView.Update();
sceneView.Repaint();
//.........这里部分代码省略.........