void OnGUI() { if (Time.timeScale == 0 || SimGUIUtil.hideGUI) { return; } if (State == QEStateType.Inactive) { // Something broke. return; } QEUtil.buttonZone = new Rect(SimGUIUtil.sysControlZone.xMin , SimGUIUtil.sysControlZone.yMax + SimGUIUtil.Margin , SimGUIUtil.sysControlZone.width , toolBarText.Length * SimGUIUtil.LineHeight + SimGUIUtil.Margin); GUILayout.BeginArea(QEUtil.buttonZone, GUI.skin.box); QEStateType sn = (QEStateType)GUILayout.SelectionGrid((int)State , toolBarText , 1 , GUI.skin.toggle); GUILayout.EndArea(); if (sn != State) { SetState(sn); } if (mState != null) { mState.OnGUI(); } SimGUIUtil.OnGUI(); }
public bool SetState(QEStateType state) { if (State == QEStateType.Inactive && !Initialize()) { return(false); } if (mState != null) { mState.Exit(); } mState = null; switch (state) { case QEStateType.GetNearestPointG: mState = new GetNearestPointG(); break; case QEStateType.FindDistanceToWall: mState = new FindDistanceToWall(); break; case QEStateType.FindPolysByRadius: mState = new FindPolysByRadius(); break; case QEStateType.FindPolysByConvex: mState = new FindPolysByConvex(); break; case QEStateType.GetPolysLocal: mState = new GetPolysLocal(); break; case QEStateType.GetNearestPointL: mState = new GetNearestPointL(); break; case QEStateType.GetNearestPointF: mState = new GetNearestPointF(); break; case QEStateType.GetPolyHeight: mState = new GetPolyHeight(); break; case QEStateType.GetPolys: mState = new GetPolys(); break; case QEStateType.GetWallSegments: mState = new GetWallSegments(); break; case QEStateType.GetSegments: mState = new GetSegments(); break; case QEStateType.FindPath: mState = new FindPath(); break; case QEStateType.StraightPath: mState = new StraightPath(); break; case QEStateType.Raycast: mState = new RaycastQE(); break; case QEStateType.MoveOnSurface: mState = new MoveAlongSurface(); break; } mState.Enter(mHelper); return(true); }