Alright, first off I am a complete scripting newbie. I ordered a bunch of books and read a bunch of tutorials, now I just gotta put it all together and make it stick. So be gentle, I don't have a numeric brain at all. I'm a visual guy.
Alright, I have some objects that I want to play some animation when you click on it. I've figured that part out. Here is my javascript.
var playing : boolean = false;
function OnMouseDown()
{
if (!playing) {
playing = true;
animation.Play("Test_Animation");
yield WaitForSeconds(animation["Test_Animation"].length);
playing = false;
}
}
I know, basic stuff. Now my question is this. Each time you click on the object it will play the animation. I want it to play the animation once, then stay in it's final state. So for example. Lets say you have a door. You click on it and it opens. I want it to stay open. No matter how many times you click on it. Currently with this script each time you click on it, it will play the open animation. So what do I add to make it only play that animation once?
Thanks guys! I really appreciate it. I've halted progress on my game until I get it completely playable in it's rough form. Which is quiet the task when I know nothing about scripting.