System.register(["cc"], function (_export, _context) {
  "use strict";

  var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, ccenum, Collider, Component, _dec, _dec2, _class, _class2, _descriptor, _crd, ccclass, property, CollisionType, Event_TriggerEnter, Event_TriggerStay, Event_TriggerExit, Event_CollisionEnter, Event_CollisionStay, Event_CollisionExit, GameCollision;

  function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }

  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }

  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }

  return {
    setters: [function (_cc) {
      _cclegacy = _cc.cclegacy;
      __checkObsolete__ = _cc.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
      _decorator = _cc._decorator;
      ccenum = _cc.ccenum;
      Collider = _cc.Collider;
      Component = _cc.Component;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "7fa3eqzDkpBUq8OUNr05VJh", "GameCollision", undefined);
      /*
       * @Author: dgflash
       * @Date: 2022-03-29 17:08:08
       * @LastEditors: dgflash
       * @LastEditTime: 2022-09-02 09:45:41
       */


      __checkObsolete__(['_decorator', 'ccenum', 'Collider', 'Component', 'ICollisionEvent', 'ITriggerEvent']);

      ({
        ccclass,
        property
      } = _decorator);
      /** 碰撞物体类型 */

      _export("CollisionType", CollisionType = /*#__PURE__*/function (CollisionType) {
        CollisionType[CollisionType["Role"] = 0] = "Role";
        CollisionType[CollisionType["Ballistic"] = 1] = "Ballistic";
        CollisionType[CollisionType["Wall"] = 2] = "Wall";
        return CollisionType;
      }({}));

      ccenum(CollisionType);
      Event_TriggerEnter = "onTriggerEnter";
      Event_TriggerStay = "onTriggerStay";
      Event_TriggerExit = "onTriggerExit";
      Event_CollisionEnter = "onCollisionEnter";
      Event_CollisionStay = "onCollisionStay";
      Event_CollisionExit = "onCollisionExit";
      /** 碰撞器与触发器 */

      _export("GameCollision", GameCollision = (_dec = ccclass('GameCollision'), _dec2 = property({
        type: CollisionType,
        tooltip: '碰撞物体类型'
      }), _dec(_class = (_class2 = class GameCollision extends Component {
        constructor() {
          super(...arguments);
          this.collider = null;

          _initializerDefineProperty(this, "type", _descriptor, this);
        }

        onLoad() {
          this.collider = this.getComponent(Collider);

          if (this.collider.isTrigger) {
            this.collider.on(Event_TriggerEnter, this.onTrigger, this);
            this.collider.on(Event_TriggerStay, this.onTrigger, this);
            this.collider.on(Event_TriggerExit, this.onTrigger, this);
          } else {
            this.collider.on(Event_CollisionEnter, this.onCollision, this);
            this.collider.on(Event_CollisionStay, this.onCollision, this);
            this.collider.on(Event_CollisionExit, this.onCollision, this);
          }
        }

        onTrigger(event) {
          switch (event.type) {
            case Event_TriggerEnter:
              this.onTriggerEnter(event);
              break;

            case Event_TriggerStay:
              this.onTriggerStay(event);
              break;

            case Event_TriggerExit:
              this.onTriggerExit(event);
              break;
          }
        }

        onTriggerEnter(event) {}

        onTriggerStay(event) {}

        onTriggerExit(event) {}

        onCollision(event) {
          switch (event.type) {
            case Event_CollisionEnter:
              this.onCollisionEnter(event);
              break;

            case Event_CollisionStay:
              this.onCollisionStay(event);
              break;

            case Event_CollisionExit:
              this.onCollisionExit(event);
              break;
          }
        }

        onCollisionEnter(event) {}

        onCollisionStay(event) {}

        onCollisionExit(event) {}

      }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "type", [_dec2], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: function initializer() {
          return CollisionType.Ballistic;
        }
      })), _class2)) || _class));

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=7d1338035e700babc9ee61beba12b7b0dee33f30.js.map