2020-06-08 16:23:48 +08:00
|
|
|
abstract class Component {
|
|
|
|
|
public entity: Entity;
|
|
|
|
|
public displayRender: egret.DisplayObject;
|
2020-06-08 18:26:05 +08:00
|
|
|
private _enabled: boolean = true;
|
|
|
|
|
public get enabled(){
|
|
|
|
|
return this.entity ? this.entity.enabled && this._enabled : this._enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public set enabled(value: boolean){
|
|
|
|
|
this.setEnabled(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public setEnabled(isEnabled: boolean){
|
|
|
|
|
if (this._enabled != isEnabled){
|
|
|
|
|
this._enabled = isEnabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2020-06-08 16:23:48 +08:00
|
|
|
|
|
|
|
|
public abstract initialize();
|
|
|
|
|
|
|
|
|
|
public update(){
|
2020-06-08 18:26:05 +08:00
|
|
|
|
2020-06-08 16:23:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 绑定显示对象 */
|
|
|
|
|
public bind(displayRender: egret.DisplayObject){
|
|
|
|
|
this.displayRender = displayRender;
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
}
|