mirror of
https://github.com/Gongxh0901/kunpolibrary
synced 2025-06-02 23:54:24 +00:00
删除形状的绘制
This commit is contained in:
parent
4269c88ff9
commit
ca2d93b475
@ -4,7 +4,7 @@
|
|||||||
* @Description: 原型
|
* @Description: 原型
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Graphics, Rect } from "cc";
|
import { Rect } from "cc";
|
||||||
import { Shape } from "./Shape";
|
import { Shape } from "./Shape";
|
||||||
|
|
||||||
export class Circle extends Shape {
|
export class Circle extends Shape {
|
||||||
@ -21,9 +21,4 @@ export class Circle extends Shape {
|
|||||||
public getBoundingBox(): Rect {
|
public getBoundingBox(): Rect {
|
||||||
return this.boundingBox;
|
return this.boundingBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
public drawShape(draw: Graphics): void {
|
|
||||||
draw && draw.circle(this.position.x, this.position.y, this.radius * this.scale);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
* @Description: 多边形
|
* @Description: 多边形
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Graphics, Rect, v2, Vec2 } from "cc";
|
import { Rect, v2, Vec2 } from "cc";
|
||||||
import { Shape } from "./Shape";
|
import { Shape } from "./Shape";
|
||||||
|
|
||||||
|
|
||||||
@ -82,16 +82,4 @@ export class Polygon extends Shape {
|
|||||||
this._realPoints[i] = v2(pts[i].x, pts[i].y);
|
this._realPoints[i] = v2(pts[i].x, pts[i].y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
public drawShape(draw: Graphics): void {
|
|
||||||
if (draw) {
|
|
||||||
let points = this.points;
|
|
||||||
draw.moveTo(points[0].x, points[0].y);
|
|
||||||
for (let i = 1; i < points.length; i++) {
|
|
||||||
draw.lineTo(points[i].x, points[i].y);
|
|
||||||
}
|
|
||||||
draw.lineTo(points[0].x, points[0].y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -299,7 +299,6 @@ export class QuadTree {
|
|||||||
this._trees[quadrant].insert(shapes.splice(i, 1)[0]);
|
this._trees[quadrant].insert(shapes.splice(i, 1)[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shape.drawShape(this._graphics);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* @Description: 四叉树的 形状基类
|
* @Description: 四叉树的 形状基类
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Graphics, Rect, Vec2 } from "cc";
|
import { Rect, Vec2 } from "cc";
|
||||||
|
|
||||||
export abstract class Shape {
|
export abstract class Shape {
|
||||||
/**
|
/**
|
||||||
@ -71,10 +71,5 @@ export abstract class Shape {
|
|||||||
public destroy(): void {
|
public destroy(): void {
|
||||||
this._valid = false;
|
this._valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
public drawShape(draw: Graphics): void {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user