ecs适配egret

This commit is contained in:
yhh
2020-06-29 15:41:02 +08:00
parent a63d8598d8
commit a4f1ae351f
33 changed files with 647 additions and 871 deletions

View File

@@ -82,15 +82,15 @@ abstract class Collider extends Component{
if (renderable){
let renderbaleBounds = renderable.bounds;
let width = renderbaleBounds.width / this.entity.transform.scale.x;
let height = renderbaleBounds.height / this.entity.transform.scale.y;
let width = renderbaleBounds.width / this.entity.scale.x;
let height = renderbaleBounds.height / this.entity.scale.y;
if (this instanceof BoxCollider){
let boxCollider = this as BoxCollider;
boxCollider.width = width;
boxCollider.height = height;
this.localOffset = Vector2.subtract(renderbaleBounds.center, this.entity.transform.position);
this.localOffset = Vector2.subtract(renderbaleBounds.center, this.entity.position);
}
}
}

View File

@@ -46,7 +46,7 @@ class Mover extends Component {
}
public applyMovement(motion: Vector2){
this.entity.transform.position = Vector2.add(this.entity.transform.position, motion);
this.entity.position = Vector2.add(this.entity.position, motion);
if (this._triggerHelper)
this._triggerHelper.update();