SDTimer.gd 310 B

12345678910111213141516171819202122232425
  1. extends Timer
  2. var action
  3. var object
  4. var arg
  5. class_name SDTimer
  6. func _init(o=null,a=null,ar=null):
  7. action = a
  8. object = o
  9. arg = ar
  10. func _ready():
  11. connect("timeout",self,"timeout")
  12. func timeout():
  13. queue_free()
  14. if action and object:
  15. if arg:
  16. object.call(action,arg)
  17. else:
  18. object.call(action)