{
  "code": "var Vector3 = Laya.Vector3;\r\nimport { GameTools } from \"../Tools/GameTools\";\r\nimport { EventManager, StageState } from \"../Tools/EventManager\";\r\nexport var CharacterState;\r\n(function (CharacterState) {\r\n    CharacterState[CharacterState[\"Run\"] = 0] = \"Run\";\r\n    CharacterState[CharacterState[\"Idle\"] = 1] = \"Idle\";\r\n    CharacterState[CharacterState[\"Die\"] = 2] = \"Die\";\r\n    CharacterState[CharacterState[\"Win\"] = 3] = \"Win\";\r\n    CharacterState[CharacterState[\"Shoot\"] = 4] = \"Shoot\";\r\n})(CharacterState || (CharacterState = {}));\r\nexport class Runner extends Laya.Script3D {\r\n    constructor() {\r\n        super();\r\n        this.canmove = false;\r\n        this._speed = 1;\r\n        this._press = false;\r\n        this.curspeed = 0;\r\n        this.currotV = new Vector3();\r\n        this.currot = new Laya.Quaternion;\r\n        this.NormalizeSpeed = new Vector3();\r\n        this.curpos = new Vector3();\r\n        this.offest = new Vector3();\r\n    }\r\n    static get Instance() {\r\n        if (Runner.ins) {\r\n            return Runner.ins;\r\n        }\r\n        else {\r\n            return new Runner();\r\n        }\r\n    }\r\n    onAwake() {\r\n        this.m_player = this.owner;\r\n        this.m_animator = this.owner.getComponent(Laya.Animator);\r\n        this.m_horseanimator = this.owner.getChildAt(1).getComponent(Laya.Animator);\r\n        this.ChangeState(CharacterState.Idle);\r\n    }\r\n    Init() {\r\n        EventManager.StageOn(StageState.Start, this, this.Begin);\r\n    }\r\n    Begin() {\r\n        this.canmove = true;\r\n        this.ChangeState(CharacterState.Run);\r\n    }\r\n    onUpdate() {\r\n        if (this.canmove) {\r\n            this.Move(new Vector3(0, 0, 1), this._speed);\r\n        }\r\n    }\r\n    MoveX(_speed) {\r\n        _speed *= 0.07;\r\n        this.m_player.transform.translate(new Vector3(_speed, 0, 0));\r\n        this.m_player.transform.position = this.m_player.transform.position.x < -4.5 ? new Vector3(-4.5, this.m_player.transform.position.y, this.m_player.transform.position.z) : this.m_player.transform.position;\r\n        this.m_player.transform.position = this.m_player.transform.position.x > 4.5 ? new Vector3(4.5, this.m_player.transform.position.y, this.m_player.transform.position.z) : this.m_player.transform.position;\r\n    }\r\n    TurnDir(_dir) {\r\n        if (_dir.x != 0) {\r\n            Vector3.lerp(this.currotV, _dir, 0.35, _dir);\r\n            this.currotV = _dir;\r\n            Laya.Quaternion.rotationLookAt(_dir, new Vector3(0, 1, 0), this.currot);\r\n            Laya.Quaternion.slerp(this.m_player.transform.rotation, this.currot, 0.025, this.currot);\r\n            this.currot = new Laya.Quaternion(0, this.currot.y, 0);\r\n            this.m_player.transform.rotation = this.currot;\r\n        }\r\n        else {\r\n            Laya.Quaternion.slerp(this.m_player.transform.rotation, new Laya.Quaternion(0, 0, 0, 0), 0.1, this.currot);\r\n            this.currot = new Laya.Quaternion(0, this.currot.y, 0);\r\n            this.m_player.transform.rotation = this.currot;\r\n        }\r\n    }\r\n    Move(_dir, _speed) {\r\n        var sp = GameTools.Instance.lerp(this.curspeed, _speed, 0.1);\r\n        this.curspeed = sp;\r\n        Vector3.scale(_dir, this.curspeed, this.offest);\r\n        Vector3.add(this.m_player.transform.position, this.offest, this.curpos);\r\n        Vector3.lerp(this.m_player.transform.position, this.curpos, 0.15, this.curpos);\r\n        this.curpos = new Vector3(this.curpos.x, this.curpos.y, this.curpos.z);\r\n        this.m_player.transform.position = this.curpos;\r\n    }\r\n    ChangeState(_state) {\r\n        if (this.m_characterstate == _state)\r\n            return;\r\n        this.m_characterstate = _state;\r\n        switch (this.m_characterstate) {\r\n            case CharacterState.Idle:\r\n                this.Idle();\r\n                break;\r\n            case CharacterState.Run:\r\n                this.Run();\r\n                break;\r\n            case CharacterState.Die:\r\n                this.Die();\r\n                break;\r\n            case CharacterState.Win:\r\n                this.Win();\r\n                break;\r\n            case CharacterState.Shoot:\r\n                this.Shoot();\r\n                break;\r\n        }\r\n    }\r\n    Idle() {\r\n        this.m_animator.play(\"Idle\");\r\n        this.m_horseanimator.play(\"Horse_Idle\");\r\n    }\r\n    Run() {\r\n        this.m_animator.play(\"Idle\");\r\n        this.m_horseanimator.play(\"Horse_Run\");\r\n    }\r\n    Die() {\r\n    }\r\n    Win() {\r\n    }\r\n    Shoot() {\r\n        this.m_animator.play(\"aimshoot\");\r\n        this.m_animator.play(\"Horse_Run\");\r\n    }\r\n}\r\n//# sourceMappingURL=Runner.js.map",
  "references": [
    "E:/LayaProject/ArcherWorrior/src/Tools/GameTools.ts",
    "E:/LayaProject/ArcherWorrior/src/Tools/EventManager.ts"
  ],
  "map": "{\"version\":3,\"file\":\"Runner.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/Game/Runner.ts\"],\"names\":[],\"mappings\":\"AAAA,IAAO,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAc,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE7E,MAAM,CAAN,IAAY,cAAsC;AAAlD,WAAY,cAAc;IAAC,iDAAG,CAAA;IAAC,mDAAI,CAAA;IAAC,iDAAG,CAAA;IAAC,iDAAG,CAAA;IAAC,qDAAK,CAAA;AAAA,CAAC,EAAtC,cAAc,KAAd,cAAc,QAAwB;AAClD,MAAM,OAAO,MAAO,SAAQ,IAAI,CAAC,QAAQ;IAgBrC;QACI,KAAK,EAAE,CAAC;QAPL,YAAO,GAAW,KAAK,CAAC;QAEvB,WAAM,GAAU,CAAC,CAAC;QAEnB,WAAM,GAAW,KAAK,CAAC;QA0B9B,aAAQ,GAAG,CAAC,CAAC;QAeb,YAAO,GAAG,IAAI,OAAO,EAAE,CAAC;QACxB,WAAM,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC;QAC7B,mBAAc,GAAW,IAAI,OAAO,EAAE,CAAC;QACvC,WAAM,GAAW,IAAI,OAAO,EAAE,CAAC;QAC/B,WAAM,GAAW,IAAI,OAAO,EAAE,CAAC;IAzC/B,CAAC;IACM,MAAM,KAAK,QAAQ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