移除物理引擎 移动到新库

This commit is contained in:
yhh
2020-06-15 10:42:06 +08:00
parent 7f8f1cf0d0
commit 16892eb7af
21 changed files with 553 additions and 1118 deletions

View File

@@ -0,0 +1,28 @@
///<reference path="./Polygon.ts" />
class Box extends Polygon {
public width: number;
public height: number;
public updateBox(width: number, height: number){
this.width = width;
this.height = height;
let halfWidth = width / 2;
let halfHeight = height / 2;
this.points[0] = new Vector2(-halfWidth, -halfHeight);
this.points[1] = new Vector2(halfWidth, -halfHeight);
this.points[2] = new Vector2(halfWidth, halfHeight);
this.points[3] = new Vector2(-halfWidth, halfHeight);
for (let i = 0; i < this.points.length; i ++)
this._originalPoints[i] = this.points[i];
}
public containsPoint(point: Vector2){
if (this.isUnrotated)
return this.bounds.contains(point);
return super.containsPoint(point);
}
}