import { math } from "cc"; import { PhysicsSystem2D } from "cc"; import GRoleBase from "../role/GRoleBase"; import { Vec2 } from "cc"; //检测工具类 export default class GDetection{ //检测角色 static testAABBCenterRole(rect:math.Rect):GRoleBase<{}>[]{ rect.x -= rect.width / 2; rect.y -= rect.height / 2; //@ts-ignore return PhysicsSystem2D.instance.testAABB(rect).map(item => item.getComponent(GRoleBase)); } //检测角色 static testPointRole(pos:Vec2){ //@ts-ignore console.log(PhysicsSystem2D.instance.testPoint(pos)); } }