unity3dMonoBehaviour章節(jié)中文翻譯_第1頁(yè)
unity3dMonoBehaviour章節(jié)中文翻譯_第2頁(yè)
unity3dMonoBehaviour章節(jié)中文翻譯_第3頁(yè)
unity3dMonoBehaviour章節(jié)中文翻譯_第4頁(yè)
unity3dMonoBehaviour章節(jié)中文翻譯_第5頁(yè)
已閱讀5頁(yè),還剩49頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、Mon oBehaviourInherits from Behaviour繼承自BehaviourMonoBehaviour is the base class every script derives from.MonoBehaviour是每個(gè)腳本的基類(lèi).Using Javascript every script automatically derives from MonoBehaviour. When using C# or Boo you have to explicitlyderive from MonoBehaviour.每個(gè)Javascript腳本自動(dòng)繼承 MonoBehavio

2、ur.使用C#或Boo時(shí),需要顯式繼承 MonoBehaviour.Note: The checkbox for disabling a MonoBehavior (on the editor) will only prevent Start(), Awake(), Update(),FixedUpdate(), and OnGUI() from executing. If none of these functions are present, the checkbox is not displayed.注意:MonoBehavior 對(duì)象(編輯器中)的復(fù)選框,只有在其有 Start(),

3、Awake(), Update(), FixedUpdate(), 和 OnGUI()函數(shù)時(shí)顯示,沒(méi)有這些函數(shù)時(shí)則隱藏.(另注:譯者在PC上Windows平臺(tái)測(cè)試結(jié)果與此注釋所描述情況不符)See Also: The chapter on scripting in the manual.VariablesuseGUILayoutDisabling this lets you skip the GUI layout phase.禁用此項(xiàng),將會(huì)跳過(guò)GUILayout部署Functions 函數(shù)InvokeInvokes the method methodName in time seconds.根

4、據(jù)時(shí)間調(diào)用指定方法名的方法InvokeRepeatingInvokes the method methodName in time seconds.根據(jù)時(shí)間調(diào)用指定方法名的方法CancelInvokeCancels all Invoke calls on this MonoBehaviour.取消這個(gè)MonoBehaviour上的所有調(diào)用.IsInvokingIs any invoke on methodName pending?某指定函數(shù)是否在等候調(diào)用StartCoroutineStarts a coroutine.開(kāi)始協(xié)同程序.StopCoroutineStops all coroutin

5、es named methodName running on this behaviour.停止這個(gè)動(dòng)作中名為methodName的所有協(xié)同程序.StopAIICoroutinesStops all coroutines running on this behaviour.停止所有動(dòng)作的協(xié)同程序.Overridable Functions可重載的函數(shù)UpdateUpdate is called every frame, if the MonoBehaviour is enabled.當(dāng)MonoBehaviour啟用時(shí),其Update在每一幀被調(diào)用LateUpdateLateUpdate is

6、called every frame, if the Behaviour is enabled. 當(dāng)MonoBehaviour啟用時(shí),其LateUpdate在每一幀被調(diào)用FixedUpdateThis function is called every fixed framerate frame, if the MonoBehaviour is enabled. 當(dāng)MonoBehaviour啟用時(shí),其FixedUpdate在每一幀被調(diào)用AwakeAwake is called when the script instance is being loaded.當(dāng)一個(gè)腳本實(shí)例被載入時(shí)Awake被調(diào)用

7、.StartStart is called just before any of the Update methods is called the first time.Start在Update調(diào)用前被調(diào)用.ResetReset to default values.重置,恢復(fù)到默認(rèn)值.OnMouseEnterOnMouseEnter is called when the mouse entered theGUIElement or Collider.當(dāng)鼠標(biāo)進(jìn)入到 GUIEIement(GUI組件)或Collider(碰撞體)中時(shí)調(diào)用OnMouseEnter.OnMouseOverOnMouse

8、Over is called every frame while the mouse is over theGUIElement or Collider.當(dāng)鼠標(biāo)懸浮在GUIElement(GUI組件)或Collider(碰撞體)上時(shí)調(diào)用OnMouseOver .OnMouseExitOnMouseExit is called when the mouse is not any longer over theGUIElement or Collider.當(dāng)鼠標(biāo)移出GUIElement(GUI組件)或Collider(碰撞體)上時(shí)調(diào)用OnMouseExitOnMouseDownOnMouseDow

9、n is called when the user has pressed the mouse button while over theGUIElement orCollii當(dāng)用戶(hù)在GUIElement(GUI組件)或Collider(碰撞體)上點(diǎn)擊鼠標(biāo)時(shí)調(diào)用 OnMouseDownOnMouseUpOnMouseUp is called when the user has released the mouse button.用戶(hù)釋放鼠標(biāo)鍵的時(shí)候調(diào)用這個(gè).OnMouseDragOnMouseDrag is called when the user has clicked on aGUIEle

10、ment or Collider and is still holding down thmouse.當(dāng)用戶(hù)鼠標(biāo)拖拽GUIElement(GUI組件)或Collider(碰撞體)時(shí)調(diào)用OnMouseDragOnTriggerEnterOnTriggerEnter is called when the Collider other enters the trigger. 當(dāng)Collider(碰撞體)進(jìn)入trigger(觸發(fā)器)時(shí)調(diào)用OnTriggerEnter.OnTriggerExitOnTriggerExit is called when the Collider other has sto

11、pped touching the trigger. 當(dāng)Collider(碰撞體形出trigger(觸發(fā)器)時(shí)調(diào)用OnTriggerExit.OnTriggerStayOnTriggerStay is called once per frame for everyCollider other that is touching the trigger.當(dāng)Collider(碰撞體)觸發(fā)trigger(觸發(fā)器)時(shí)在每一幀調(diào)用OnTriggerStay.OnCollisionEnterOnCollisionEnter is called when this collider/rigidbody has

12、 begun touching another rigidbody/collider. 當(dāng)此 collider/rigidbody 觸發(fā)另一個(gè) rigidbody/collider 時(shí),0nCollisionEnter 將被調(diào)用.OnCollisionExitOnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.OnCollisionStayOnControllerColliderHitOnJointBreakOnParticleCollisi

13、onOnBecameVisibleOnBecameInvisibleOnLevelWasLoadedOnEnableOnDisable當(dāng)此 collider/rigidbody 停止觸發(fā)另一個(gè) rigidbody/collider 時(shí)QnCollisionExit 將被調(diào)用.OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. 當(dāng)此 collider/rigidbody 觸發(fā)另一個(gè) rigidbody/collider 時(shí),0nColl

14、isionStay 將會(huì)在每一幀被調(diào)用. OnControllerColliderHit is called when the controller hits a collider while performing a Move. 當(dāng) controller 碰撞到 collider 時(shí) OnControllerHit 被調(diào)用.Called when a joint attached to the same game object broke.當(dāng)附在同一對(duì)象上的關(guān)節(jié)被斷開(kāi)時(shí)調(diào)用.OnParticleCollision is called when a particle hits a collid

15、er.當(dāng)粒子碰到collider時(shí)被調(diào)用.OnBecameVisible is called when the renderer became visible by any camera.當(dāng)renderer(渲染器)在任何相機(jī)上可見(jiàn)時(shí)調(diào)用 OnBecameVisible.OnBecameInvisible is called when the renderer is no longer visible by any camera.當(dāng)renderer(渲染器)在任何相機(jī)上都不可見(jiàn)時(shí)調(diào)用 OnBecameInvisible.This function is called after a new l

16、evel was loaded.當(dāng)一個(gè)新關(guān)卡被載入時(shí)此函數(shù)被調(diào)用.This function is called when the object becomes enabled and active.當(dāng)對(duì)象變?yōu)榭捎没蚣せ顮顟B(tài)時(shí)此函數(shù)被調(diào)用.This function is called when the behaviour becomes disabled () or inactive.當(dāng)對(duì)象變?yōu)椴豢捎没蚍羌せ顮顟B(tài)時(shí)此函數(shù)被調(diào)用.OnPreCullOnPreCull is called before a camera culls the scene.OnPreRenderOnPostRende

17、rOnRenderObjectOnWillRenderObjectOnGUIOnRenderlmageOnDrawGizmosSelectedOnDrawGizmosOnApplicationPause在相機(jī)剪裁場(chǎng)景之前被調(diào)用.OnPreRender is called before a camera starts rendering the scene.在相機(jī)渲染場(chǎng)景之前被調(diào)用.OnPostRender is called after a camera finished rendering the scene.在相機(jī)完成場(chǎng)景渲染之后被調(diào)用.OnRenderObject is called a

18、fter camera has rendered the scene.在相機(jī)場(chǎng)景渲染完成后被調(diào)用OnWillRenderObject is called once for each camera if the object is visible.如果對(duì)象可見(jiàn)每個(gè)相機(jī)都會(huì)調(diào)用它.OnGUI is called for rendering and handling GUI events.渲染和處理GUI事件時(shí)調(diào)用.OnRenderImage is called after all rendering is complete to render image當(dāng)完成所有渲染后被調(diào)用,用來(lái)渲染圖片后期效果

19、.Implement this OnDrawGizmosSelected if you want to draw gizmos only if the object is selected.如果你想在物體被選中時(shí)繪制gizmos,去實(shí)現(xiàn)這個(gè)函數(shù).Implement this OnDrawGizmos if you want to draw gizmos that are also pickable and always drawn. 如果你想繪制可被點(diǎn)選的gizmos,去實(shí)現(xiàn)這個(gè).Sent to all game objects when the player pauses.當(dāng)玩家暫停時(shí)發(fā)送到

20、所有的游戲物體.OnApplicationFocusSent to all game objects when the player gets or looses focus.當(dāng)玩家獲取或失去焦點(diǎn)時(shí)發(fā)送給所有游戲物體OnApplicationQuitSent to all game objects before the application is quit.在應(yīng)用退出之前發(fā)送給所有的游戲物體.OnPlayerConnectedCalled on the server whenever a new player has successfully connected.當(dāng)一個(gè)新玩家成功連接時(shí)在服務(wù)

21、器上被調(diào)用.OnServerlnitializedCalled on the server whenever a Network .I nitializeServer was invoked and has completed. 當(dāng)Network.InitializeServer被調(diào)用并完成時(shí),在服務(wù)器上調(diào)用這個(gè)函數(shù)OnConnectedToServerCalled on the client when you have successfully connected to a server當(dāng)你成功連接到服務(wù)器時(shí),在客戶(hù)端被調(diào)用.OnPlayerDisconnectedCalled on the

22、 server whenever a player disconnected from the server.當(dāng)一個(gè)玩家從服務(wù)器上斷開(kāi)時(shí)在服務(wù)器端調(diào)用.OnDisconnectedFromServerCalled on the client when the connection was lost or you disconnected from the server.當(dāng)失去連接或從服務(wù)器端斷開(kāi)時(shí)在客戶(hù)端調(diào)用.OnFailedToConnectCalled on the client when a connection attempt fails for some reason.當(dāng)一個(gè)連接因?yàn)?/p>

23、某些原因失敗時(shí)在客戶(hù)端調(diào)用.OnFailedToConnectToMasterServerCalled on clients or servers when there is a problem connecting to the MasterServer.當(dāng)連接主服務(wù)器出現(xiàn)問(wèn)題時(shí)在客戶(hù)端或服務(wù)器端調(diào)用.OnMasterServerEventCalled on clients or servers when reporting events from the MasterServer.當(dāng)報(bào)告事件來(lái)自主服務(wù)器時(shí)在客戶(hù)端或服務(wù)器端調(diào)用.OnNetworklnstantiateCalled on o

24、bjects which have been network instantiated withNetwork.Instantiate當(dāng)一個(gè)物體使用Network.Instantiate進(jìn)行網(wǎng)絡(luò)初始化時(shí)調(diào)用.OnSerializeNetworkViewUsed to customize synchronization of variables in a script watched by a network view.在一個(gè)網(wǎng)絡(luò)視圖腳本中,用于自定義變量同步Class Functions 類(lèi)函數(shù)printLogs message to the Unity Console. This funct

25、ion is identical toDebug.Log .記錄消息到Unity控制臺(tái).這個(gè)函數(shù)和Debug.Log作用相同.In herited members被繼承的成員Inherited Variables 被繼承的變量enabledEnabled Behaviours are Updated, disabled Behaviours are not.啟用時(shí)Behaviours會(huì)執(zhí)行更新,反之不更新.transformThe Transform attached to this GameObject (null if there is none attached). 附加在本游戲?qū)ο笊系?/p>

26、Transform(沒(méi)有則為null).rigidbodyThe Rigidbody attached to this GameObject (null if there is none attached). 附加在本游戲?qū)ο笊系腞igidbody (沒(méi)有則為null).cameraThe Camera attached to this GameObject (null if there is none attached).附加在本游戲?qū)ο笊系腃amera (沒(méi)有則為null).lightThe Light attached to this GameObject (null if there

27、is none attached).附加在本游戲?qū)ο笊系腖ight (沒(méi)有則為null).animationThe Animation attached to this GameObject (null if there is none attached). 附加在本游戲?qū)ο笊系腶nimation (沒(méi)有則為null).constantForceThe ConstantForce attached to this GameObject (null if there is none attached). 附加在本游戲?qū)ο笊系腃onstantForce(沒(méi)有則為null).rendererThe

28、Renderer attached to this GameObject (null if there is none attached). 附加在本游戲?qū)ο笊系腞enderer (沒(méi)有則為null).audioThe AudioSource attached to this GameObject (null if there is none attached). 附加在本游戲?qū)ο笊系腁udioSource (沒(méi)有則為null).guiTextThe GUIText attached to this GameObject (null if there is none attached). 附加

29、在本游戲?qū)ο笊系腉UIText (沒(méi)有則為null).networkviewThe NetworkView attached to this GameObject (Read Only). (null if there is none attached) 附加在本游戲?qū)ο笊系腘etworkView (只讀)(沒(méi)有則為null).guiTextureThe GUITexture attached to this GameObject (Read Only). (null if there is none attached) 附加在本游戲?qū)ο笊系腉UITexture (只讀)(沒(méi)有則為null).

30、colliderThe Collider attached to this GameObject (null if there is none attached). 附加在本游戲?qū)ο笊系腃ollider (沒(méi)有則為null).hingeJointThe HingeJoint attached to this GameObject (null if there is none attached). 附加在本游戲?qū)ο笊系腍ingeJoint (沒(méi)有則為null).particleEmitterThe ParticleEmitter attached to this GameObject (null

31、 if there is none attached). 附加在本游戲?qū)ο笊系腜articleEmitter(沒(méi)有則為null).gameObjectThe game object this component is attached to. A component is always attached to a game object. 該組件附加的游戲?qū)ο?組件總是附加在一個(gè)游戲?qū)ο笊?tagThe tag of this game object.該游戲?qū)ο蟮臉?biāo)簽.nameThe name of the object.該游戲?qū)ο蟮拿?hideFlagsShould the object

32、be hidden, saved with the scene or modifiable by the user?設(shè)置是否隱藏,保存在場(chǎng)景中或被用戶(hù)修改.Inherited Functions 被繼承的函數(shù)GetComponentReturns the component of Type type if the game object has one attached, null if it doesnt.返回游戲?qū)ο笊夏愁?lèi)型的組件.沒(méi)有則返回null.GetComponentlnChildrenReturns the component of Type type in the GameOb

33、ject or any of its children using depth first search.返回游戲?qū)ο蠡蚱渥游矬w上某類(lèi)型的組件.沒(méi)有則返回null.搜素時(shí)深度優(yōu)先.GetComponentsInChildrenReturns all components of Type type in the GameObject or any of its children.返回游戲?qū)ο蠡蚱渥游矬w上所有某類(lèi)型的組件GetComponentsReturns all components of Type type in the GameObject .返回游戲?qū)ο笊夏愁?lèi)型的所有組件.Compar

34、eTagIs this game object tagged tag?核對(duì)游戲?qū)ο蟮臉?biāo)簽SendMessageUpwardsCalls the method named methodName on everyMonoBehaviour in this game object and on every ancestor of theBehaviour在該游戲?qū)ο蟮乃蠱onoBehaviour上及其父物體上調(diào)用名為methodName的方法,SendMessageCalls the method named methodName on everyMonoBehaviour in this gam

35、e object.在該游戲?qū)ο蟮乃?MonoBehaviour上調(diào)用名為 methodName的方法,BroadcastMessageCalls the method named methodName on everyMonoBehaviour in this game object or any of its children.在該游戲?qū)ο蟮乃蠱onoBehaviour上及其子物體上調(diào)用名為 methodName的方法,GetlnstancelDReturns the instance id of the object.返回該物體的實(shí)例ID.Inherited Class Functio

36、ns被繼承的類(lèi)函數(shù)operator boolDoes the object exist?判斷物體是否存在.InstantiateClones the object original and returns the clone.復(fù)制一個(gè)物體并返回該備份.DestroyRemoves a gameobject, component or asset.移除一個(gè)物體,組件或資源.DestroyImmediateDestroys the object obj immediately. It is strongly recommended to use Destroy instead.立刻銷(xiāo)毀一個(gè)物體.建

37、議用Destroy代替之.FindObjectsOfTypeReturns a list of all active loaded objects of Type type.返回找到的所有指定類(lèi)型的對(duì)象.FindObjectOfTypeReturns the first active loaded object of Type type.返回找到的指定類(lèi)型的第一個(gè)對(duì)象operator =Compares if two objects refer to the same比較兩個(gè)物體是否相同.operator !=Compares if two objects refer to a differe

38、nt object比較兩個(gè)物體是否不同.DontDestroyOnLoadMakes the object target not be destroyed automatically when loading a new scene.確保目標(biāo)對(duì)象在加載新場(chǎng)景時(shí)不被自動(dòng)銷(xiāo)毀Mon oBehaviour.useGUILayoutDescriptionDisabling this lets you skip the GUI layout phase.禁用此項(xiàng),將會(huì)跳過(guò)GUILayout部署階段It can only be used if you do not use GUI.Window and G

39、UILayout inside of this OnGUI call. 它只用于在假如你不用GUI.Window和GUILayout的時(shí)候.Mon oBehaviournv okefunction Invoke (methodName : string, time : float) : voidDescriptionInvokes the method methodName in time seconds.根據(jù)時(shí)間調(diào)用指定方法名的方法JavaScript/ Launches a projectile in 2 seconds/ 2秒后發(fā)射炮彈var projectile :Rigidbody

40、;Invoke(LaunchProjectile, 2);function LaunchProjectile () var instance :Rigidbody = Instantiate(projectile);instance.velocity =Random.insideUnitSphere* 5;Mon oBehaviournv okeRepeat ingfunction InvokeRepeating (methodName :string , time : float, repeatRate : float) : voidDescriptionInvokes the method

41、 methodName in time seconds.根據(jù)時(shí)間調(diào)用指定方法名的方法After the first invocation repeats calling that function every repeatRate seconds.從第一次調(diào)用開(kāi)始,每隔repeatRate時(shí)間調(diào)用一次.JavaScript/ Starting in 2 seconds./ a projectile will be launched every 0.3 seconds/ 2秒后開(kāi)始/每0.3秒發(fā)射一顆炮彈var projectile :Rigidbody ;lnvokeRepeating(Lau

42、nchProjectile, 2, 0.3);function LaunchProjectile () var instance :Rigidbody = Instantiate(projectile);instance.velocity =Random.insideUnitSphere* 5;Mon oBehaviour.Ca ncell nv okefunction Cancellnvoke () : voidDescriptionCancels all Invoke calls on this MonoBehaviour.取消這個(gè)MonoBehaviour上的所有調(diào)用JavaScript

43、/ Starting in 2 seconds./ a projectile will be launched every 0.3 seconds/ 2秒后開(kāi)始/每0.3秒發(fā)射一顆炮彈var projectile :Rigidbody ;InvokeRepeating(LaunchProjectile, 2, 0.3);/ Cancels the repeating invoke call,/ when the user pressed the ctrl button/當(dāng)用戶(hù)按下ctrl鍵取消repeating調(diào)用 function Update() if ( Input GetButton

44、(Firel)Cancellnvoke();function LaunchProjectile () instance = Instantiate(projectile);instance.velocity = Random.insideUnitSphere * 5;function Cancellnvoke (methodName :string ) : voidDescriptionCancels all Invoke calls with name methodName on this behaviour.取消所有名為methodName的調(diào)用.JavaScript/ Starting

45、in 2 seconds./ a projectile will be launched every 0.3 seconds/ 2秒后開(kāi)始/每0.3秒發(fā)射一顆炮彈var projectile :Rigidbody ;lnvokeRepeating(LaunchProjectile, 2, 0.3);/ Cancels the repeating invoke call,/ when the user pressed the ctrl button/當(dāng)用戶(hù)按下ctrl鍵取消repeating調(diào)用function Update() if ( Input.GetButton (Fire1)Cance

46、llnvoke(LaunchProjectile);function LaunchProjectile () instance = Instantiate(projectile);instance.velocity =Random.insideUnitSphere* 5;Mon oBehaviourslnvokingDescriptionIs any invoke on methodName pending?某指定函數(shù)是否在等候調(diào)用.JavaScript/ Instantiates a project after 2 seconds whenSpace key was pressed/ and

47、 it will only call the function after the function has ended its execution/按下空格鍵2秒后實(shí)例化一個(gè)炮彈,在該函數(shù)執(zhí)行完畢之前僅調(diào)用此函數(shù)var projectile :Rigidbody ;function Update() if( Input.GetKeyDown ( KeyCode.Space ) & !IsInvoking(LaunchProjectile) lnvoke(LaunchProjectile, 2);function LaunchProjectile () var instance :Rigidb

48、ody = Instantiate(projectile);instance.velocity = Random.insideUnitSphere * 5;function IsInvoking () : boolDescriptionIs any invoke pending on this MonoBehaviour?此MonoBehaviour上是否有調(diào)用在等候.Mon oBehaviour .StartCorout inefunction StartCoroutine (routine : lEnumerator) :CoroutineDescriptionStarts a corou

49、tine.開(kāi)始協(xié)同程序.The execution of a coroutine can be paused at any point using the yield statement. The yield return value specifies when the coroutine is resumed. Coroutines are excellent when modelling behaviour over several frames. Coroutines have virtually no performance overhead. StartCoroutine func

50、tion always returns immediately, however you can yield the result. This will wait until the coroutine has finished execution.一個(gè)協(xié)同程序在執(zhí)行過(guò)程中,可以在任意位置使用yield語(yǔ)句.yield的返回值控制何時(shí)恢復(fù)協(xié)同程序向下執(zhí)行.協(xié)同程序在 對(duì)象自有幀執(zhí)行過(guò)程中堪稱(chēng)優(yōu)秀.協(xié)同程序在性能上沒(méi)有更多的開(kāi)銷(xiāo).StartCoroutine函數(shù)是立刻返回的,但是yield可以延 遲結(jié)果.直到協(xié)同程序執(zhí)行完畢.When using JavaScript it is not nec

51、essary to use StartCoroutine, the compiler will do this for you. When writing C# code you must call StartCoroutine.用javascript不需要添加StartCoroutine,編譯器將會(huì)替你完成.但是在C#下,你必須調(diào)用StartCoroutine.JavaScript/ In this example we show how to invoke a coroutine and continue executing/ the function in parallel./此例演示如

52、何調(diào)用協(xié)同程序和它的執(zhí)行function Start() / - After 0 seconds, prints Starting 0.0/ - After 0 seconds, prints Before WaitAndPrint Finishes 0.0/ - After 2 seconds, prints WaitAndPrint 2.0/ 先打印Starting 0.0 和Before WaitAndPrint Finishes 0.0 兩句,2 秒后打印WaitAndPrint 2.0 print (Starting + Time.time );/ Start function Wa

53、itAndPrint as a coroutine. And continue execution while it is running/ this is the same as WaintAndPrint(2.0) as the compiler does it for you automatically/協(xié)同程序WaitAndPrint 在Start函數(shù)內(nèi)執(zhí)行,可以視同于它與Start函數(shù)同步執(zhí)行. StartCoroutine(WaitAndPrint(2.0);print (Before WaitAndPrint Finishes +Time.time );function Wait

54、AndPrint (waitTime : float) / suspend execution for waitTime seconds/暫停執(zhí)行waitTime 秒yield WaitForSeconds (waitTime);print (WaitAndPrint + Time.time );Ano ther Example:JavaScript/ In this example we show how to invoke a coroutine and wait until it/ is completed/在這個(gè)例子中我們演示如何調(diào)用協(xié)同程序并直到它執(zhí)行完成.function Star

55、t() / - After 0 seconds, prints Starting 0.0/ - After 2 seconds, prints WaitAndPrint 2.0/ - After 2 seconds, prints Done 2.0/ 0 秒時(shí)打印Starting 0.0,2秒后打印WaitAndPrint 2.0和Done 2.0print (Starting + Time.time );/ Start function WaitAndPrint as a coroutine. And wait until it is completed./ the same as yield WaitAndPrint(2.0);/運(yùn)行WaitAndPrint 直到完成yield StartCoroutine(WaitAndPrint(2.0);print (Done + Time.time );function WaitAndPrint (waitTime : float) / suspend execution for waitTim

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論