新增sceneTransition 用于场景过渡

This commit is contained in:
YHH
2020-06-21 10:27:15 +08:00
parent 60646edd6b
commit 3d9730d956
22 changed files with 2292 additions and 226 deletions

View File

@@ -9,6 +9,10 @@ class Physics {
this._spatialHash = new SpatialHash(this.spatialHashCellSize);
}
public static clear(){
this._spatialHash.clear();
}
public static overlapCircleAll(center: Vector2, randius: number, results: any[], layerMask = -1){
return this._spatialHash.overlapCircle(center, randius, results, layerMask);
}

View File

@@ -53,10 +53,8 @@ class Polygon extends Shape {
public collidesWithShape(other: Shape){
let result = new CollisionResult();
if (other instanceof Polygon){
result = ShapeCollisions.polygonToPolygon(this, other);
return result;
return ShapeCollisions.polygonToPolygon(this, other);
}
if (other instanceof Circle){
result = ShapeCollisions.circleToPolygon(other, this);

View File

@@ -52,6 +52,10 @@ class SpatialHash {
}
}
public clear(){
this._cellDict.clear();
}
public overlapCircle(circleCenter: Vector2, radius: number, results: Collider[], layerMask) {
let bounds = new Rectangle(circleCenter.x - radius, circleCenter.y - radius, radius * 2, radius * 2);