1. 程式人生 > >Unity3D - LeanTouch例子中的各指令碼

Unity3D - LeanTouch例子中的各指令碼

1 物體選擇

1.1 LeanSelect

This component allows you to select LeanSelectable components

此方法允許你選擇物體(需要在待選物體上掛上LeanSelectable指令碼)

1.2 LeanSelectable

This component makes this GameObject selectable.

To then select it, you can use LeanSelect and trigger the selection from LeanFingerTap or similar.

此元件使物體可選擇.

要想選定物體, 你可以使用LeanSelect指令碼並將使事件由LeanFingerTap指令碼觸發

1.3 LeanSelectableBehaviour

This script makes handling selectable actions easier.

此指令碼使處理可選擇物件的行為更容易

1.4 LeanSelectableGraphicColor

This script allows you to change the color of the Graphic (e.g. Image) attached to the current GameObject.

此指令碼允許你改變吸附在當前物體上的物體顏色

1.5 LeanSelectableRendererColor

This script allows you to change the color of the Renderer attached to the current GameObject

此指令碼允許你改變吸附在當前物體上的渲染器的顏色.

1.6 LeanSelectableSpriteRendererColor

This script allows you to change the color of the SpriteRenderer attached to the current GameObject

此指令碼允許你改變吸附在當前物體上的Sprite渲染器的顏色

2 縮放 平移和旋轉物體

2.1 LeanTranslate

This script allows you to translate the current GameObject relative to the camera.

此指令碼允許您將當前GameObject相對於相機進行轉換。(似乎只能移動, 在與相機正向射線垂直的平面上移動)(不用和其它指令碼連起來)

2.2 LeanRotate

This script allows you to transform the current GameObject

此方法允許你transform(旋轉 平移 縮放)當前物體  (感覺跟上面那個差不多)

2.3 LeanRotateCustomAxis

This component allows you to rotate the current GameObject around a specific local axis using finger twists

此方法允許你旋轉當前物件, 圍繞著特定的本地軸, 使用手指擰

2.4 LeanScale

This script allows you to scale the current GameObject

此指令碼允許你縮放當前物體(不用和其它指令碼連起來)

2.5 LeanCanvasArrow

This script rotates the current GameObject based on a finger swipe angle

此指令碼根據手勢輕掃角度旋轉物體. (引數是Vector2 delta)

3 相機移動事件

3.1 LeanCameraMove

This script allows you to track & pedestral this GameObject (e.g. Camera) based on finger drags

本指令碼允許你基於手指拖動跟蹤和(步行?)某物件.

個人理解: 移動的是相機, 但是看起來像是物體在動

3.2 LeanCameraZoom

This script allows you to zoom a camera in and out based on the pinch gesture. This supports both perspective and orthographic cameras.

此指令碼允許使用捏合手勢縮放相機. 支援透視相機和正交相機.

4 短按 長按和輕掃

4.1 LeanFingerHeld

This script fires events if a finger has been held for a certain amount of time without moving

此指令碼在手指按住螢幕一段時間(並且手指沒有移動)後觸發事件

4.2 LeanFingerSwipe

This script fires events if a finger has been held for a certain amount of time without moving

此指令碼在手指按住一定時間後觸發事件.

4.3 LeanFingerTap

This script calls the OnFingerTap event when a finger taps the screen

此指令碼在手指Tap螢幕時呼叫OnFingerTap事件

5 繪製軌跡事件

5.1 LeanFingerTrail

This script will draw the path each finger has taken since it started being pressed

此指令碼繪製手指開始按下後每一個手指的路徑.

5.2 LeanFingerLine

This script will modify LeanFingerTrail to draw a straight line

此指令碼將修改(繼承)LeanFingerTrail以繪製直線

6 三大基本事件

6.1 LeanFingerDown

This script calls the OnFingerDown event when a finger touches the screen

此指令碼在手指觸控式螢幕幕時呼叫OnFingerDown方法.

6.2 LeanFingerSet

This script calls the OnFingerSet event while a finger is touching the screen

此腳本當手指正在觸控式螢幕幕的時候.呼叫OnFingerSet事件

6.3 LeanFingerUp

This script calls the OnFingerUp event when a finger stops touching the screen

此指令碼在手指離開螢幕時呼叫OnFingerUp方法

7 其它功能

7.1 LeanSpawnAt [生成預製件]

This component allows you to spawn a prefab at a single point

此元件允許你在某一點生成一個預製件

7.2 LeanTouchEvents [輸出日誌]

This script will hook into event LeanTouch event, and spam the console with the information

此指令碼將勾住LeanTouch的事件, 並向控制檯輸出事件日誌

7.3 LeanOpenUrl [開啟URL]

無官方註釋. 程式碼是Application.URL(string url);

7.4 LeanDestroy [銷燬物體]

This script will automatically destroy this GameObject after 'Seconds' seconds

If you want to manually destroy this GameObject, then disable this component, and call DestroyNow

此指令碼會在seconds秒之後自動銷燬物體.

如果想要手動銷燬物體, 可以先disable這個物體, 然後呼叫DestroyNow

8 不認識的元件

8.1 LeanPath

This component stores a list of points that form a path

此方法儲存構成路徑的一系列點.

8.2 LeanPlane

This component stores information about a 3D plane

此元件儲存3D平面的資訊.

8.3 LeanScreenDepth

This struct allows you to convert from a screen point to a world point using a variety of different methods

此結構允許你使用不同的方法把螢幕座標轉換為世界座標. (轉換方法參見官方文件, 我翻譯了)