您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223
  1. extends KinematicBody
  2. signal switch
  3. export var initial_state := false
  4. var activated := false
  5. func _ready():
  6. activated = initial_state
  7. update_view()
  8. emit_signal("switch", activated)
  9. func on_interact():
  10. activated = !activated
  11. update_view()
  12. emit_signal("switch", activated)
  13. func update_view():
  14. if activated:
  15. $AnimationPlayer.play("On")
  16. else:
  17. $AnimationPlayer.play("Off")