Quote:
Originally Posted by Crow
I suppose you catch the event from the GUI object you animate?
|
Oh true I misread. In that case I suppose I could always catch the event in a separate weapon from the one being destroyed.
Edit: Works, albeit this is slightly complicated when there's a chance the GUI can quickly be recreated, and its creation is also animated.
Which means I have:
Class within Weapon about to be destroyed -
PHP Code:
temp.gui.destroying = true;
SomeSystemWeapon.scheduleDestroyGUI(temp.gui);
Weapon -
PHP Code:
public function scheduleDestroyGUI(temp.gui){
thiso.catchevent(temp.gui.name, "onAnimationFinished", "destroyGUI");
}
function destroyGUI(temp.gui){
if(temp.gui.destroying){
this.ignoreevent(temp.gui.name, "onAnimationFinished");
temp.gui.destroy();
}
}
Whereas using the scheduleevent method it would be:
Class within Weapon about to be destroyed -
PHP Code:
SomeSystemWeapon.scheduleDestroyGUI(temp.gui, temp.time);
PHP Code:
public function scheduleDestroyGUI(temp.gui, temp.time){
thiso.scheduleEvent(temp.time, "DestroyGUI", temp.gui);
}
function onDestroyGUI(temp.gui){
if(temp.gui != NULL){
temp.gui.destroy();
}
}
It works fine for me either way, I just thought a built-in variable to handle it would make things easier.