init framework

This commit is contained in:
yhh
2020-06-08 11:49:45 +08:00
parent a2fd5153ad
commit db077d187c
125 changed files with 140474 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
class Transform {
/** 相关联的实体 */
public readonly entity: Entity;
private _children: Transform[];
private _parent: Transform;
public get childCount(){
return this._children.length;
}
constructor(entity: Entity){
this.entity = entity;
this._children = [];
}
public getChild(index: number){
return this._children[index];
}
public get parent(){
return this._parent;
}
public set parent(value: Transform){
this.setParent(value);
}
public setParent(parent: Transform){
if (this._parent == parent)
return this;
if (this._parent)
this._parent._children.remove(this);
if (parent)
parent._children.push(this);
this._parent = parent;
return this;
}
}