30SetGet
对标一些语言的 Setter函数和Getter函数。(配合Autoload和signal就可以通知其他地方当前值的更改,比如实例中更新health 进度条ui)
1
2
3
4
var health:int =60:
get: return health
set(value):
health=value
代码链接信号
1
2
3
Globals.connect("signal_name",callback)
#或者
Globals.signal_name.connect(callback)
其实还有_set、_get
This post is licensed under CC BY 4.0 by the author.