新增entity/component等transform便捷方法

This commit is contained in:
yhh
2020-06-09 11:09:26 +08:00
parent 262e16bb88
commit 9e0d14da7c
13 changed files with 1308 additions and 5 deletions

View File

@@ -2,6 +2,12 @@ abstract class Component {
public entity: Entity;
public displayRender: egret.DisplayObject;
private _enabled: boolean = true;
public updateInterval: number = 1;
public get transform(){
return this.entity.transform;
}
public get enabled(){
return this.entity ? this.entity.enabled && this._enabled : this._enabled;
}
@@ -13,6 +19,12 @@ abstract class Component {
public setEnabled(isEnabled: boolean){
if (this._enabled != isEnabled){
this._enabled = isEnabled;
if (this._enabled){
this.onEnabled();
}else{
this.onDisabled();
}
}
return this;