Beispiel #1
0
    void changeCurrentView(TouchLookView view, bool noRotation)
    {
        Vector3 pos = transform.localPosition;

        switch (view)
        {
        case TouchLookView.TlVw_Normal:
            pos.y = vwCapNormalPosY;
            if (!noRotation)
            {
                transform.Rotate(-90, 0, 0);
            }
            break;

        case TouchLookView.TlVw_Top:
            if (roomScaleWidth * roomScaleLength != 1.0F)
            {
                pos.y = vwCapTopPosY * Mathf.Max(roomScaleWidth, roomScaleLength);
            }
            else
            {
                pos.y = vwCapTopPosY;
            }
            if (!noRotation)
            {
                transform.Rotate(90, 0, 0);
            }
            break;
        }
        transform.localPosition = pos;
    }
Beispiel #2
0
 void OnGUI()
 {
     if (touchLookView == TouchLookView.TlVw_Normal)
     {
         if (GUI.RepeatButton(new Rect(posLeft, posTop, guiboxWidth, guiboxHeight), "<<"))
         {
             touchLookCmd = TouchLookCommand.TlCmd_TurnLeft;
         }
         if (GUI.RepeatButton(new Rect(Screen.width - posLeft - guiboxWidth, posTop, guiboxWidth, guiboxHeight), ">>"))
         {
             touchLookCmd = TouchLookCommand.TlCmd_TurnRight;
         }
         if (GUI.Button(new Rect(Screen.width / 2 - guiboxWidth / 2, posTop, guiboxWidth, guiboxHeight), "Top View"))
         {
             touchLookView = TouchLookView.TlVw_Top;
             changeView    = true;
         }
     }
     else if (touchLookView == TouchLookView.TlVw_Top)
     {
         if (GUI.Button(new Rect(Screen.width / 2 - guiboxWidth / 2, posTop, guiboxWidth, guiboxHeight), "Normal View"))
         {
             touchLookView = TouchLookView.TlVw_Normal;
             changeView    = true;
         }
         if (GUI.Button(new Rect(posLeft, posTop, guiboxWidth, guiboxHeight), "Width"))
         {
             roomScaleWidth += roomWidthChange;
             if (roomScaleWidth > 2.0F)
             {
                 roomWidthChange = -1 * roomWidthChange;
                 roomScaleWidth  = 2.0F;
             }
             if (roomScaleWidth < 1.0F)
             {
                 roomWidthChange = -1 * roomWidthChange;
                 roomScaleWidth  = 1.0F;
             }
             touchLookCmd = TouchLookCommand.TlCmd_ChangeRoomScale;
         }
         if (GUI.Button(new Rect(Screen.width - posLeft - guiboxWidth, posTop, guiboxWidth, guiboxHeight), "Length"))
         {
             roomScaleLength += roomLengthChange;
             if (roomScaleLength > 2.0F)
             {
                 roomLengthChange = -1 * roomLengthChange;
                 roomScaleLength  = 2.0F;
             }
             if (roomScaleLength < 1.0F)
             {
                 roomLengthChange = -1 * roomLengthChange;
                 roomScaleLength  = 1.0F;
             }
             touchLookCmd = TouchLookCommand.TlCmd_ChangeRoomScale;
         }
     }
 }