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

  var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, Collider2D, RigidBody2D, input, Input, log, _dec, _class, _crd, ccclass, property, PlayerController;

  return {
    setters: [function (_cc) {
      _cclegacy = _cc.cclegacy;
      __checkObsolete__ = _cc.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
      _decorator = _cc._decorator;
      Component = _cc.Component;
      Collider2D = _cc.Collider2D;
      RigidBody2D = _cc.RigidBody2D;
      input = _cc.input;
      Input = _cc.Input;
      log = _cc.log;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "39486GYhLxMoIqs3xj5qsna", "PlayerController", undefined);

      __checkObsolete__(['_decorator', 'Component', 'Node', 'Collider2D', 'RigidBody2D', 'input', 'Input', 'EventMouse', 'log', 'Vec2']);

      ({
        ccclass,
        property
      } = _decorator);

      _export("PlayerController", PlayerController = (_dec = ccclass('PlayerController'), _dec(_class = class PlayerController extends Component {
        constructor() {
          super(...arguments);
          this._startJump = false;
          this._jumpStep = 0;
          this._curJumpTime = 0;
          this._jumpTime = 0.3;
          this._curJumpSpeed = 0;
        }

        start() {}

        update(deltaTime) {}

        setInputActive(active) {
          if (active) {
            input.on(Input.EventType.MOUSE_UP, this.onMouseUp, this);
          } else {
            input.off(Input.EventType.MOUSE_UP, this.onMouseUp, this);
          }
        }

        onMouseUp(event) {
          log('鼠标按下');
          log(event.getButton());

          if (event.getButton() === 0) {
            this.jump();
          }
        }

        jump() {
          // if(this._startJump)return
          // this._startJump = true
          var rb = this.getComponent(RigidBody2D);
          var lv = rb.linearVelocity;
          log(lv);
          lv.y += 100; // 更改穿透属性
          // this.getComponent(Collider2D).sensor = true

          this.getComponent(Collider2D).apply(); // let linear = this.rigidbody.linearVelocity
          // // 禁止在空中触发跳跃
          // if (linear.y != 0) {
          //     return
          // }
          // let lx = linear.x / Math.abs(linear.x) * this.speed
          // this.rigidbody.linearVelocity = v2(linear.x, this.jumpHeight)
          // // 更改穿透属性
          // this.getComponent(Collider2D).sensor = true
        }

      }) || _class));

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=03304b08fe0c66928a0a4902900e62f9e086d721.js.map