{
  "code": "var Vector3 = Laya.Vector3;\r\nimport { Scene3DManager } from \"./Scene3DManager\";\r\nimport { MathTool } from \"../Util/MathTool\";\r\nimport { GlobalParam } from \"../Net/GlobalParam\";\r\nimport { GamePool } from \"./GamePool\";\r\nimport { ColliderGroup } from \"./ColliderAndMusicType\";\r\nimport { Mound } from \"./Mound\";\r\nimport { ParticleManager } from \"./ParticleManager\";\r\nimport { Opponent } from \"./Opponent\";\r\nimport StreetManager from \"../Manager/StreetManager\";\r\nimport { GameManager } from \"./GameManager\";\r\nvar Sprite = Laya.Sprite;\r\nexport class MainRoleShot extends Laya.Script3D {\r\n    constructor() {\r\n        super(...arguments);\r\n        this.speed = MathTool.VecZero;\r\n        this._forward = new Vector3(0, 0, 1);\r\n        this.over = false;\r\n    }\r\n    onAwake() {\r\n        this.selfobj = this.owner;\r\n        this.tran = this.selfobj.transform;\r\n        this.rayPoint = this.selfobj.getChildByName(\"rayPoint\").transform;\r\n        this.speed.z = GlobalParam.shootspeed;\r\n    }\r\n    Run() {\r\n        this.tran.translate(this.speed);\r\n        let d = Vector3.distance(this.tarTran.position, this.tran.position);\r\n        if (d >= GlobalParam.bulletMaxDis) {\r\n            this.RecoverBullet();\r\n            return;\r\n        }\r\n        this.RayReset();\r\n    }\r\n    RecoverBullet() {\r\n        Laya.timer.clearAll(this);\r\n        GamePool.Instance.RecoverModel(this.selfobj);\r\n        GamePool.bulletCount--;\r\n    }\r\n    drawSomething() {\r\n        this.sp = new Sprite();\r\n        Laya.stage.addChild(this.sp);\r\n        this.sp.graphics.drawLine(10, 58, 146, 58, \"#ff0000\", 3);\r\n        this.sp.graphics.drawLines(176, 58, [0, 0, 39, -50, 78, 0, 117, 50, 156, 0], \"#ff0000\", 5);\r\n        this.sp.graphics.drawCurves(352, 58, [0, 0, 19, -100, 39, 0, 58, 100, 78, 0, 97, -100, 117, 0, 136, 100, 156, 0], \"#ff0000\", 5);\r\n        this.sp.graphics.drawRect(10, 166, 166, 90, \"#ffff00\");\r\n        this.sp.graphics.drawPoly(264, 166, [0, 0, 60, 0, 78.48, 57, 30, 93.48, -18.48, 57], \"#ffff00\");\r\n        this.sp.graphics.drawPoly(400, 166, [0, 100, 50, 0, 100, 100], \"#ffff00\");\r\n        this.sp.graphics.drawCircle(98, 332, 50, \"#00ffff\");\r\n        this.sp.graphics.drawPie(240, 290, 100, 10, 60, \"#00ffff\");\r\n        this.sp.graphics.drawPath(400, 310, [[\"moveTo\", 5, 0], [\"lineTo\", 105, 0], [\"arcTo\", 110, 0, 110, 5, 5], [\"lineTo\", 110, 55], [\"arcTo\", 110, 60, 105, 60, 5], [\"lineTo\", 5, 60], [\"arcTo\", 0, 60, 0, 55, 5], [\"lineTo\", 0, 5], [\"arcTo\", 0, 0, 5, 0, 5], [\"closePath\"]], { fillStyle: \"#00ffff\" });\r\n    }\r\n    RayReset() {\r\n        let origP = this.rayPoint.position.clone();\r\n        if (!this._scene) {\r\n            this._scene = Scene3DManager.Instance.MainScene;\r\n        }\r\n        if (!this.ray) {\r\n            if (!this.forward)\r\n                this.forward = MathTool.VecZero;\r\n            this.ray = new Laya.Ray(MathTool.VecZero, this._forward);\r\n            this.outHit = new Laya.HitResult();\r\n        }\r\n        this.ray.origin = origP;\r\n        if (this.over) {\r\n            this.tran.getForward(this.forward);\r\n            this.forward.x = -this.forward.x;\r\n            this.forward.y = -this.forward.y;\r\n            this.forward.z = -this.forward.z;\r\n            this.ray.direction = this.forward;\r\n        }\r\n        else {\r\n            this.ray.direction = this._forward;\r\n        }\r\n        let isHItF = this._scene.physicsSimulation.rayCast(this.ray, this.outHit, GlobalParam.bulletRayLength);\r\n        if (isHItF) {\r\n            let obj = this.outHit.collider.owner;\r\n            if (obj.layer == ColliderGroup.mound) {\r\n                let tower = obj.getComponent(Mound);\r\n                if (tower) {\r\n                    tower.Injured(this.outHit.point);\r\n                }\r\n            }\r\n            else if (obj.layer == ColliderGroup.opponent) {\r\n                let tower = obj.getComponent(Opponent);\r\n                if (tower) {\r\n                    tower.Injured(this.outHit.point);\r\n                }\r\n            }\r\n            else if (obj.layer == ColliderGroup.obstacle1 || obj.layer == ColliderGroup.obstacle2 || obj.layer == ColliderGroup.obstacle3) {\r\n                StreetManager.Instance.StreetAtkedCube(obj);\r\n                GameManager.Instance.blockCount++;\r\n            }\r\n            else {\r\n                ParticleManager.Instance.AttackEffect(this.outHit.point);\r\n            }\r\n            this.RecoverBullet();\r\n            return;\r\n        }\r\n    }\r\n    Start(tarTran, isover = false) {\r\n        this.tarTran = tarTran;\r\n        this.over = isover;\r\n        Laya.timer.frameLoop(1, this, this.Run);\r\n    }\r\n}\r\n//# sourceMappingURL=MainRoleShot.js.map",
  "references": [
    "C:/Users/Administrator/Desktop/gungang/src/Game/Scene3DManager.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Util/MathTool.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Net/GlobalParam.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/GamePool.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/ColliderAndMusicType.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/Mound.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/ParticleManager.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/Opponent.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/Street.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Manager/StreetManager.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/GameManager.ts"
  ],
  "map": "{\"version\":3,\"file\":\"MainRoleShot.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/Game/MainRoleShot.ts\"],\"names\":[],\"mappings\":\"AAEA,IAAO,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACj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