b815515a16497e87717db8b82edc334c82d403c8.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. System.register(["cc"], function (_export, _context) {
  2. "use strict";
  3. var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, GroupItem, PhysicsUtil, _crd;
  4. _export({
  5. GroupItem: void 0,
  6. PhysicsUtil: void 0
  7. });
  8. return {
  9. setters: [function (_cc) {
  10. _cclegacy = _cc.cclegacy;
  11. __checkObsolete__ = _cc.__checkObsolete__;
  12. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  13. }],
  14. execute: function () {
  15. _crd = true;
  16. _cclegacy._RF.push({}, "c1584nuvI9HtJ5IHcmFEBzR", "PhysicsUtil", undefined);
  17. /*
  18. * @Author: dgflash
  19. * @Date: 2022-07-21 17:30:59
  20. * @LastEditors: dgflash
  21. * @LastEditTime: 2022-09-02 14:40:28
  22. */
  23. /** 物理分组数据 */
  24. __checkObsolete__(['Node']);
  25. _export("GroupItem", GroupItem = class GroupItem {
  26. /** 分组值 */
  27. get value() {
  28. return this._value;
  29. }
  30. /** 分组名 */
  31. get name() {
  32. return this._name;
  33. }
  34. /** 碰撞掩码 */
  35. get mask() {
  36. return 1 << this._value;
  37. }
  38. /**
  39. * 构造函数
  40. * @param value 分组值
  41. * @param name 分组名
  42. */
  43. constructor(value, name) {
  44. this._value = void 0;
  45. this._name = void 0;
  46. this._value = value;
  47. this._name = name;
  48. }
  49. });
  50. /***
  51. * 为了方便使用,将编辑器中的物理分组定义到代码。如果编辑器中有修改,确保同步到这里。
  52. */
  53. _export("PhysicsUtil", PhysicsUtil = class PhysicsUtil {
  54. static setNodeLayer(item, node) {
  55. node.layer = item.mask;
  56. node.children.forEach(n => {
  57. n.layer = item.mask;
  58. PhysicsUtil.setNodeLayer(item, n);
  59. });
  60. }
  61. });
  62. /** 默认物理分组 */
  63. PhysicsUtil.DEFAULT = new GroupItem(0, 'DEFAULT');
  64. /** 能通过屏幕触摸中发出的射线检查到的游戏对象 */
  65. PhysicsUtil.GAME_OBJECT_SELECT = new GroupItem(1, 'GAME_OBJECT_SELECT');
  66. /** 玩家自己 */
  67. PhysicsUtil.GAME_OWNER = new GroupItem(2, 'GAME_OWNER');
  68. _cclegacy._RF.pop();
  69. _crd = false;
  70. }
  71. };
  72. });
  73. //# sourceMappingURL=b815515a16497e87717db8b82edc334c82d403c8.js.map