2025-02-20 11:27:28 +08:00
|
|
|
/**
|
|
|
|
* @Author: Gongxh
|
|
|
|
* @Date: 2024-12-21
|
|
|
|
* @Description: 原型
|
|
|
|
*/
|
|
|
|
|
2025-05-26 17:27:59 +08:00
|
|
|
import { Rect } from "cc";
|
2025-05-27 18:19:41 +08:00
|
|
|
import { ShapeType } from "./IShape";
|
2025-02-20 11:27:28 +08:00
|
|
|
import { Shape } from "./Shape";
|
|
|
|
|
|
|
|
export class Circle extends Shape {
|
|
|
|
public radius: number; // 半径
|
2025-05-27 18:19:41 +08:00
|
|
|
|
|
|
|
public get shapeType(): ShapeType {
|
|
|
|
return ShapeType.CIRCLE;
|
|
|
|
}
|
|
|
|
|
2025-02-20 11:27:28 +08:00
|
|
|
constructor(radius: number, tag: number = -1) {
|
|
|
|
super(tag);
|
|
|
|
this.radius = radius;
|
2025-05-27 18:19:41 +08:00
|
|
|
this._boundingBox.x = -this.radius;
|
|
|
|
this._boundingBox.y = -this.radius;
|
|
|
|
this._boundingBox.width = this.radius * 2;
|
|
|
|
this._boundingBox.height = this.radius * 2;
|
2025-02-20 11:27:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public getBoundingBox(): Rect {
|
2025-05-27 18:19:41 +08:00
|
|
|
return this._boundingBox;
|
2025-02-20 11:27:28 +08:00
|
|
|
}
|
|
|
|
}
|