{
  "code": "var Vector2 = Laya.Vector2;\r\nvar Vector3 = Laya.Vector3;\r\nimport { GameTools } from \"../Tools/GameTools\";\r\nimport { AssetManager } from \"../Tools/AssetManager\";\r\nexport class PlayerControl {\r\n    constructor() {\r\n        this.mousepos = new Vector2(0, 0);\r\n        this.offx = 0;\r\n        this.curtouchsmoothness = 0.02;\r\n        this.poschazhi = new Vector3();\r\n        this.gengsuipos = new Vector3();\r\n        this.lllpos = new Vector3();\r\n        this.hights = 0;\r\n        this.wights = 0;\r\n        PlayerControl.ins = this;\r\n    }\r\n    static get Instance() {\r\n        if (PlayerControl.ins) {\r\n            return PlayerControl.ins;\r\n        }\r\n        else {\r\n            return new PlayerControl();\r\n        }\r\n    }\r\n    Init(_player) {\r\n        this.Player = _player;\r\n        this.Player.transform.position = new Vector3();\r\n        this.Camera = AssetManager.Instance.maincamera;\r\n        this.Camera.transform.position = new Vector3(0, 15, -10);\r\n        this.Camera.transform.localRotationEuler = new Vector3(-25, 0, 0);\r\n        this.MouseListen();\r\n        this.CameraFollow();\r\n    }\r\n    MouseListen() {\r\n        Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.OnTouchEnter);\r\n        Laya.stage.on(Laya.Event.MOUSE_UP, this, this.OnTouchOut);\r\n        Laya.stage.on(Laya.Event.MOUSE_OUT, this, this.OnTouchOut);\r\n    }\r\n    OnTouchEnter() {\r\n        this.mousepos = new Vector2(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY);\r\n        Laya.timer.clear(this, this.OnTouchMove);\r\n        Laya.timer.frameLoop(1, this, this.OnTouchMove);\r\n    }\r\n    OnTouchOut() {\r\n        Laya.timer.clear(this, this.OnTouchMove);\r\n    }\r\n    OnTouchMove() {\r\n        var MousePos = new Vector2(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY);\r\n        var offestX = MousePos.x - this.mousepos.x;\r\n        this.offx = GameTools.Instance.lerp(this.offx, offestX, this.curtouchsmoothness);\r\n        var movespeed = this.offx * 0.07;\r\n        this.Player.transform.translate(new Vector3(-movespeed, 0, 0));\r\n        this.Player.transform.position = this.Player.transform.position.x < -4.5 ? new Vector3(-4.5, this.Player.transform.position.y, this.Player.transform.position.z) : this.Player.transform.position;\r\n        this.Player.transform.position = this.Player.transform.position.x > 4.5 ? new Vector3(4.5, this.Player.transform.position.y, this.Player.transform.position.z) : this.Player.transform.position;\r\n        var dir = new Vector3(-offestX * 0.001, 0, 0);\r\n        this.mousepos = MousePos;\r\n    }\r\n    CameraFollow() {\r\n        this.hights = 0;\r\n        this.wights = 0;\r\n        Vector3.subtract(this.Player.transform.position, this.Camera.transform.position, this.poschazhi);\r\n        Laya.timer.frameLoop(1, this, this.GenSui);\r\n    }\r\n    GenSui() {\r\n        Vector3.subtract(this.Player.transform.position, this.poschazhi, this.gengsuipos);\r\n        this.hights = GameTools.Instance.lerp(this.hights, 1.0, 0.03);\r\n        this.wights = GameTools.Instance.lerp(this.wights, 0.8, 0.02);\r\n        this.gengsuipos = new Vector3(this.gengsuipos.x, this.gengsuipos.y, this.gengsuipos.z - this.wights);\r\n        Vector3.lerp(this.Camera.transform.position, this.gengsuipos, 0.25, this.lllpos);\r\n        this.lllpos = new Vector3(this.gengsuipos.x, this.gengsuipos.y, this.lllpos.z);\r\n        this.lllpos = new Vector3(this.gengsuipos.x, this.lllpos.y, this.lllpos.z);\r\n        this.Camera.transform.position = this.lllpos;\r\n        var qqqwe = new Laya.Quaternion();\r\n        var eyePos = new Vector3(this.gengsuipos.x, this.gengsuipos.y - 0.8, this.gengsuipos.z);\r\n        Laya.Quaternion.lookAt(eyePos, this.Player.transform.position, new Vector3(0, 1, 0), qqqwe);\r\n        qqqwe.invert(qqqwe);\r\n        Laya.Quaternion.slerp(this.Camera.transform.rotation, qqqwe, 0.1, qqqwe);\r\n        this.Camera.transform.rotation = qqqwe;\r\n    }\r\n}\r\n//# sourceMappingURL=PlayerControl.js.map",
  "references": [
    "E:/LayaProject/ArcherWorrior/src/Tools/GameTools.ts",
    "E:/LayaProject/ArcherWorrior/src/Tools/AssetManager.ts"
  ],
  "map": "{\"version\":3,\"file\":\"PlayerControl.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/Game/PlayerControl.ts\"],\"names\":[],\"mappings\":\"AAAA,IAAO,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAC9B,IAAO,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,MAAM,OAAO,aAAa;IAItB;QA2BA,aAAQ,GAAG,IAAI,OAAO,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;QAC5B,SAAI,GAAG,CAAC,CAAC;QACT,uBAAkB,GAAG,IAAI,CAAC;QA6BzB,cAAS,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,eAAU,GAAG,IAAI,OAAO,EAAE,CAAC;QAC3B,WAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QACvB,WAAM,GAAG,CAAC,CAAC;QACX,WAAM,GAAG,CAAC,CAAC;QA7DR,aAAa,CAAC,GAAG,GAAG,IAAI,CAAC;IAC7B,CAAC;IACM,MAAM,KAAK,QAAQ;QACtB,IAAG,aAAa,CAAC,GAAG,EAAC;YACjB,OAAO,aAAa,CAAC,GAAG,CAAA;SAC3B;aACG;YACA,OAAO,IAAI,aAAa,EAAE,CAAC;SAC9B;IACL,CAAC;IACD,IAAI,CAAC,OAAqB;QACtB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG,IAAI,OAAO,EAAE,CAAC;QAE/C,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,CAAC,EAAC,EAA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