c# - How to wait some seconds before doing something in OnMouseUp Event -


I am writing a game with some animation, and when users click on a button then use those animations . I would like to show the animation to the user, and not just call "new" a new level with "just" application.loadLevel. I thought I could use the time. Add the onMouseUp method to DeltaTime and add it to a predefined 0f value, then check that it is larger than 1f (for example), but it will not work as the onMouseUp method is only "this is your time" as the delta time < / P>

My script now looks like this:

  Public class ClickScriptAnim: MonobeHawk {Pressed Public Sprite; Public Sprite BTN; Public Game Object Target; Public string message; Public transit network; Private bull anime = true; Private animator animator; Private float in these gaming = 0f; Use it for initialization zero start () (animator = mesh.GetComponent & lt; Animator & gt; ();} // update is called once per line zero (update) () zero} OnMouseDown () {animator.SetBool ("callAnim", is true);} zero OnMouseUp () {animator.SetBool ("callAnim", false); animator.SetBool ("colgoeve", true); float animetime = timedelatetime; debug .Log (inGameTime.ToString ()); // I want to give some space to wait a few seconds goal. Message Message (Message, SendMessageOptions.RequireReceiver);}}}}  

I'm not completely sure that the time delta time since the last frame in OnMouseUp It was only in seconds, and you should do any work to try to use it. Usually it is used in a function that is called every frame, not the only non-occurring events such as onMouseUp.

Notwithstanding this, what you try to achieve Hey, it seems that you should use Invoke:

Just want to delay a different function, and then add that function to the delay in OnMouseUp

EDIT: Some other people have said here that I will not use the thread in this example to back up. () in this instance.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -