新增渲染接口
This commit is contained in:
@@ -7,10 +7,13 @@ module es {
|
||||
*
|
||||
* @param radius
|
||||
*/
|
||||
constructor(radius: number) {
|
||||
constructor(radius: number = 1) {
|
||||
super();
|
||||
|
||||
this.shape = new Circle(radius);
|
||||
if (radius == 1) {
|
||||
this._colliderRequiresAutoSizing = true;
|
||||
}
|
||||
}
|
||||
|
||||
public get radius(): number {
|
||||
@@ -40,6 +43,17 @@ module es {
|
||||
return this;
|
||||
}
|
||||
|
||||
public debugRender(batcher: IBatcher) {
|
||||
batcher.drawHollowRect(this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height, new Color(76, 76, 76, 76), 2);
|
||||
batcher.end();
|
||||
batcher.drawCircle(this.shape.position, this.radius, new Color(139, 0, 0), 2);
|
||||
batcher.end();
|
||||
batcher.drawPixel(this.entity.transform.position, new Color(255, 255, 0), 4);
|
||||
batcher.end();
|
||||
batcher.drawPixel(this.shape.position, new Color(255, 0, 0), 2);
|
||||
batcher.end();
|
||||
}
|
||||
|
||||
public toString() {
|
||||
return `[CircleCollider: bounds: ${this.bounds}, radius: ${(this.shape as Circle).radius}]`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user