移除所有egret 依赖。移除renderablecomponent及所有依赖,移除camera。保持ecs基础框架
This commit is contained in:
@@ -79,7 +79,7 @@ module es {
|
||||
return Vector2.distanceSquared(circleCenter, point) < radius * radius;
|
||||
}
|
||||
|
||||
public static rectToCircle(rect: egret.Rectangle, cPosition: Vector2, cRadius: number): boolean {
|
||||
public static rectToCircle(rect: Rectangle, cPosition: Vector2, cRadius: number): boolean {
|
||||
if (this.rectToPoint(rect.x, rect.y, rect.width, rect.height, cPosition))
|
||||
return true;
|
||||
|
||||
|
||||
@@ -217,10 +217,10 @@ module es {
|
||||
if (collider.shouldColliderScaleAndRotateWithTransform) {
|
||||
let hasUnitScale = true;
|
||||
let tempMat: Matrix2D;
|
||||
let combinedMatrix = Matrix2D.create().translate(-this._polygonCenter.x, -this._polygonCenter.y);
|
||||
let combinedMatrix = Matrix2D.createTranslation(-this._polygonCenter.x, -this._polygonCenter.y);
|
||||
|
||||
if (!collider.entity.transform.scale.equals(Vector2.one)) {
|
||||
tempMat = Matrix2D.create().scale(collider.entity.transform.scale.x, collider.entity.transform.scale.y);
|
||||
tempMat = Matrix2D.createScale(collider.entity.transform.scale.x, collider.entity.transform.scale.y);
|
||||
combinedMatrix = combinedMatrix.multiply(tempMat);
|
||||
hasUnitScale = false;
|
||||
|
||||
@@ -229,7 +229,7 @@ module es {
|
||||
}
|
||||
|
||||
if (collider.entity.transform.rotation != 0) {
|
||||
tempMat = Matrix2D.create().rotate(collider.entity.transform.rotation);
|
||||
tempMat = Matrix2D.createRotation(collider.entity.transform.rotation);
|
||||
combinedMatrix = combinedMatrix.multiply(tempMat);
|
||||
|
||||
// 为了处理偏移原点的旋转我们只需要将圆心在(0,0)附近移动
|
||||
@@ -241,7 +241,7 @@ module es {
|
||||
collider.entity.transform.rotationDegrees + offsetAngle);
|
||||
}
|
||||
|
||||
tempMat = Matrix2D.create().translate(this._polygonCenter.x, this._polygonCenter.y);
|
||||
tempMat = Matrix2D.createTranslation(this._polygonCenter.x, this._polygonCenter.y);
|
||||
combinedMatrix = combinedMatrix.multiply(tempMat);
|
||||
|
||||
// 最后变换原始点
|
||||
|
||||
@@ -53,7 +53,7 @@ module es {
|
||||
for (let y = p1.y; y <= p2.y; y++) {
|
||||
// 如果没有单元格,我们需要创建它
|
||||
let c: Collider[] = this.cellAtPosition(x, y, true);
|
||||
if (!c.firstOrDefault(c => c.hashCode == collider.hashCode))
|
||||
if (!c.firstOrDefault(c => c == collider))
|
||||
c.push(collider);
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ module es {
|
||||
continue;
|
||||
|
||||
if (bounds.intersects(collider.bounds)) {
|
||||
if (!this._tempHashSet.firstOrDefault(c => c.hashCode == collider.hashCode))
|
||||
if (!this._tempHashSet.firstOrDefault(c => c == collider))
|
||||
this._tempHashSet.push(collider);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user