mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
22 lines
542 B
TypeScript
22 lines
542 B
TypeScript
|
import { math } from "cc";
|
||
|
import { PhysicsSystem2D } from "cc";
|
||
|
import GRoleBase from "../role/GRoleBase";
|
||
|
import { Vec2 } from "cc";
|
||
|
|
||
|
|
||
|
//检测工具类
|
||
|
export default class GDetection{
|
||
|
|
||
|
//检测角色
|
||
|
static testAABBRole(rect:math.Rect):GRoleBase<{}>[]{
|
||
|
//@ts-ignore
|
||
|
return PhysicsSystem2D.instance.testAABB(rect).map(item => item.getComponent(GRoleBase<any>));
|
||
|
}
|
||
|
//检测角色
|
||
|
static testPointRole(pos:Vec2){
|
||
|
//@ts-ignore
|
||
|
console.log(PhysicsSystem2D.instance.testPoint(pos));
|
||
|
}
|
||
|
|
||
|
}
|