新增Phyisics.overlapRectangle

新增TextureUtils.premultiplyAlpha
新增Entity快速访问Transform内联方法
This commit is contained in:
yhh
2020-12-15 11:46:33 +08:00
parent c60fe13d71
commit 8ed3eb24c3
10 changed files with 491 additions and 52 deletions

View File

@@ -203,6 +203,72 @@ module es {
this.components.onEntityTransformChanged(comp);
}
public setParent(parent: Entity);
public setParent(parent: Transform);
public setParent(parent: Transform | Entity) {
if (parent instanceof Transform) {
this.transform.setParent(parent);
} else if (parent instanceof Entity) {
this.transform.setParent(parent.transform);
}
return this;
}
public setPosition(x: number, y: number){
this.transform.setPosition(x, y);
return this;
}
public setLocalPosition(localPosition: Vector2) {
this.transform.setLocalPosition(localPosition);
return this;
}
public setRotation(radians: number){
this.transform.setRotation(radians);
return this;
}
public setRotationDegrees(degrees: number){
this.transform.setRotationDegrees(degrees);
return this;
}
public setLocalRotation(radians: number){
this.transform.setLocalRotation(radians);
return this;
}
public setLocalRotationDegrees(degrees: number){
this.transform.setLocalRotationDegrees(degrees);
return this;
}
public setScale(scale: number);
public setScale(scale: Vector2);
public setScale(scale: Vector2 | number) {
if (scale instanceof Vector2) {
this.transform.setScale(scale);
} else {
this.transform.setScale(new Vector2(scale));
}
return this;
}
public setLocalScale(scale: number);
public setLocalScale(scale: Vector2);
public setLocalScale(scale: Vector2 | number) {
if (scale instanceof Vector2) {
this.transform.setLocalScale(scale);
} else {
this.transform.setLocalScale(new Vector2(scale));
}
return this;
}
/**
* 设置实体的标记
* @param tag