hi am doing a small work, where i have to play an elevator animation, only after completing the elevator door close animation. am trying to figure it out. need help.
This is just a outline of how you could write it:
Note: I haven’t tested this, and it’s probably a pretty poor way of going about it. But due to the nature of your question. It’s the best your going to get I imagine. It should at least get you started.
Questions like this should probably be in the forum. And also, people in the answer sections won’t write code for you.
(The exception being here is I was quite interested in this myself and thought i’d give it a quick go)
If you want to keep it simple, I’d use bools to control the door states. Open/Closed, goUp/goDown
Good luck, and just be careful where you post, hope this helps
bool goUp = true;
bool goDown = false;
bool showButtonGUI = true;
void Update(){
void pressElevatorButton(){
if(goUp == true){
animation.play("goUp");
goUp = false;
}
if(goDown == true){
animation.play("goDown");
goDown = false;
}
}
void Update(){
if(animation("goUp").isPlaying == true || animation("goDown").isPlaying == true){
showButtonGUI = false;
} else {
showButtonGUI = true;
//Do everything!
}
}
void OnGUI(){
if(showButtonGUI == true){
if(GUI.Button( new Rect( 10,10,200,20), "Elevator Button")){
pressElevatorButton();
}
}
}