{
  "code": "import { GameTools } from \"../GameUtils/GameTools\";\r\nvar Vector3 = Laya.Vector3;\r\nimport { Transform3DHelper } from \"../GameUtils/NodeUtil\";\r\nimport { DispatcherManager, StageState } from \"../GameUtils/EventManager\";\r\nimport { AssetManager } from \"../Resources/AssetManager\";\r\nimport { MateMove } from \"./MateMove\";\r\nexport class RoleMoveBehav extends Laya.Script3D {\r\n    constructor() {\r\n        super();\r\n        this.start = false;\r\n        this.Downhit = new Laya.HitResult();\r\n        this.FowardHit = new Laya.HitResult();\r\n        this.isdead = false;\r\n        this.curpos = new Vector3();\r\n        this.offest = new Vector3();\r\n        this.curspeed = 0;\r\n        this.PosArr = [];\r\n    }\r\n    onAwake() {\r\n        this.m_player = this.owner;\r\n        DispatcherManager.StageOn(StageState.Start, this, this.Start);\r\n    }\r\n    Start() {\r\n        this.start = true;\r\n    }\r\n    onUpdate() {\r\n        if (!this.start)\r\n            return;\r\n        if (this.isdead) {\r\n            this.ChangeDeadState();\r\n            return;\r\n        }\r\n        if (this.DownRayCheck) {\r\n        }\r\n        else {\r\n            this.isdead = true;\r\n        }\r\n        if (this.FowardRayCheck) {\r\n        }\r\n        let foward = Transform3DHelper.getForward(this.m_player.transform);\r\n        this.Move(foward, 0.2);\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        if (this.PosArr.length == 2) {\r\n            this.PosArr.shift();\r\n        }\r\n        this.PosArr.push(this.m_player.transform.position.clone());\r\n    }\r\n    get DownRayCheck() {\r\n        var isDownHit = false;\r\n        var boxCollider = new Laya.BoxColliderShape(0.2, 0.2, 0.2);\r\n        var from = new Vector3(this.m_player.transform.position.x, this.m_player.transform.position.y + 0.5, this.m_player.transform.position.z);\r\n        var dir = new Vector3(0, -100, 0);\r\n        var to = new Vector3(0, 0, 0);\r\n        Vector3.add(from, dir, to);\r\n        if (AssetManager.Instance.mainscene.physicsSimulation.shapeCast(boxCollider, from, to, this.Downhit)) {\r\n            if (this.Downhit != null) {\r\n                if (this.Downhit.collider.collisionGroup == 1 || this.Downhit.collider.collisionGroup == 100) {\r\n                    isDownHit = true;\r\n                }\r\n            }\r\n        }\r\n        return isDownHit;\r\n    }\r\n    get FowardRayCheck() {\r\n        var isFowardHit = false;\r\n        var startPos = new Vector3(this.m_player.transform.position.x, this.m_player.transform.position.y + 0.1, this.m_player.transform.position.z + 0.2);\r\n        let foward = Transform3DHelper.getForward(this.m_player.transform);\r\n        var FowardRay = new Laya.Ray(startPos, foward);\r\n        if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this.FowardHit, 1)) {\r\n            if (this.FowardHit) {\r\n                console.log(this.FowardHit.collider.owner.name);\r\n                console.log(\"前方有物体\");\r\n            }\r\n            if (this.FowardHit.collider.collisionGroup == 100) {\r\n                console.log(\"射线打到npc了\");\r\n                this.ForwardTarget = this.FowardHit.collider;\r\n                isFowardHit = true;\r\n                let _mate = this.FowardHit.collider.owner.parent.getComponent(MateMove);\r\n                if (_mate) {\r\n                    _mate.Start();\r\n                }\r\n            }\r\n        }\r\n        return isFowardHit;\r\n    }\r\n    ChangeDeadState() {\r\n        this.destroy();\r\n    }\r\n}\r\n//# sourceMappingURL=RoleMoveBehav.js.map",
  "references": [
    "E:/LayaProject/DanceLine/RubikCube/src/GameUtils/GameTools.ts",
    "E:/LayaProject/DanceLine/RubikCube/src/GameUtils/NodeUtil.ts",
    "E:/LayaProject/DanceLine/RubikCube/src/GameUtils/EventManager.ts",
    "E:/LayaProject/DanceLine/RubikCube/src/Resources/AssetManager.ts",
    "E:/LayaProject/DanceLine/RubikCube/src/Game/MateM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