{
  "code": "import { PlayerManager } from \"../Manager/PlayerManager\";\r\nimport { Vector3Helper } from \"../GameUtils/Vector3Helper\";\r\nvar Vector3 = Laya.Vector3;\r\nvar Quaternion = Laya.Quaternion;\r\nexport class MateMove extends Laya.Script3D {\r\n    constructor() {\r\n        super();\r\n        this._speed = 0.05;\r\n        this.geted = false;\r\n        this._arriver = false;\r\n        this._forward = new Vector3(0, 0, 0);\r\n        this._up = new Vector3(0, 1, 0);\r\n        this.PosArr = [];\r\n    }\r\n    onAwake() {\r\n        this._gameobject = this.owner;\r\n        this._tranform = this._gameobject.transform;\r\n        this._quaternion = new Quaternion();\r\n        this._animator = this._gameobject.getChildAt(0).getComponent(Laya.Animator);\r\n    }\r\n    onUpdate() {\r\n        if (!this.geted)\r\n            return;\r\n        if (this._arriver) {\r\n            this.RayCheck();\r\n        }\r\n        if (!this._arriver) {\r\n            this.Move();\r\n            return;\r\n        }\r\n    }\r\n    Start() {\r\n        if (this.geted)\r\n            return;\r\n        let _data = PlayerManager.Instance.GetMatePos();\r\n        if (!_data) {\r\n            console.error(\"位置已满--\");\r\n            return;\r\n        }\r\n        this.datapar = _data;\r\n        this.datapar[\"havepos\"] = true;\r\n        this.parent = this.datapar[\"model\"];\r\n        this.parentTran = this.parent.transform;\r\n        this.geted = true;\r\n    }\r\n    Move() {\r\n        let tarPos = this.parentTran.position.clone();\r\n        Vector3.subtract(tarPos, this._tranform.position, this._forward);\r\n        Vector3.normalize(this._forward, this._forward);\r\n        this._forward = new Vector3(this._forward.x * this._speed, this._forward.y * this._speed, this._forward.z * this._speed);\r\n        this._tranform.translate(this._forward, false);\r\n        if (Vector3.distance(this._tranform.position, tarPos) < 0.1) {\r\n            this.ArriverTargetPos();\r\n            return;\r\n        }\r\n        Quaternion.lookAt(tarPos, this._tranform.position, this._up, this._quaternion);\r\n        this._quaternion.invert(this._quaternion);\r\n        Quaternion.slerp(this._tranform.rotation, this._quaternion, 0.1, this._quaternion);\r\n        this._tranform.rotation = this._quaternion.clone();\r\n    }\r\n    ArriverTargetPos() {\r\n        this._arriver = true;\r\n        this.parent.addChild(this._gameobject);\r\n        this._tranform.localPosition = Vector3Helper.Zero;\r\n        let tween = Laya.Tween.to(this._tranform, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {\r\n            tween.clear();\r\n            this._tranform.localRotationEuler = Vector3Helper.Zero;\r\n        }, null, false));\r\n    }\r\n    RayCheck() {\r\n    }\r\n}\r\n//# sourceMappingURL=MateMove.js.map",
  "references": [
    "E:/LayaProject/DanceLine/RubikCube/src/Manager/PlayerManager.ts",
    "E:/LayaProject/DanceLine/RubikCube/src/GameUtils/Vector3Helper.ts"
  ],
  "map": "{\"version\":3,\"file\":\"MateMove.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/Game/MateMove.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,IAAO,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAG9B,IAAO,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;AAEpC,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,QAAQ;IACvC;QACI,KAAK,EAAE,CAAC;QAMJ,WAAM,GAAU,IAAI,CAAC;QAEtB,UAAK,GAAW,KAAK,CAAC;QAEtB,aAAQ,GAAW,KAAK,CAAC;QAKxB,aAAQ,GAAG,IAAI,OAAO,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC;QAC9B,QAAG,GAAG,IAAI,OAAO,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC;QAE1B,WAAM,GAAa,EAAE,CAAC;IAjB7B,CAAC;IAmBM,OAAO;QACV,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAsB,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,CA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