c9acb2d24043cf03ddc9e3aa12b3315efd2d622a 2.8 KB

1234567891011
  1. {
  2. "code": "var Vector3 = Laya.Vector3;\r\nimport { Mathf } from \"../Util/Mathf\";\r\nimport { PoolManager } from \"./PoolManager\";\r\nimport PlayerController from \"./PlayerController\";\r\nimport GameManager from \"./GameManager\";\r\nimport { GlobalVariable } from \"../game_module/GlobalVariable\";\r\nexport class BossBullet extends Laya.Script3D {\r\n constructor() {\r\n super(...arguments);\r\n this.isStartCollider = false;\r\n this.speed = 0.7;\r\n this.forW = Mathf.VecZero;\r\n this.quaternion1 = new Laya.Quaternion;\r\n this.iszhong = false;\r\n }\r\n onAwake() {\r\n this.selfobj = this.owner;\r\n this.tran = this.selfobj.transform;\r\n this.isStartCollider = false;\r\n this.speed = GlobalVariable.bulletSpeed;\r\n }\r\n SetStartP(t, tar, offset, iszhong) {\r\n Laya.timer.once(2000, this, this.Des);\r\n this.isStartCollider = true;\r\n this.tran.position = t.clone();\r\n this.iszhong = iszhong;\r\n this.tar = tar;\r\n let tarpos = Mathf.VecZero;\r\n tarpos.x = this.tar.position.x + offset.x;\r\n tarpos.y = this.tar.position.y + offset.y;\r\n tarpos.z = this.tar.position.z + offset.z;\r\n Vector3.subtract(tarpos, this.tran.position, this.forW);\r\n Vector3.normalize(this.forW, this.forW);\r\n this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);\r\n Laya.Quaternion.lookAt(tarpos, this.tran.position, new Vector3(0, 1, 0), this.quaternion1);\r\n this.quaternion1.invert(this.quaternion1);\r\n this.tran.rotation = this.quaternion1.clone();\r\n Laya.timer.frameLoop(1, this, this._MOVE);\r\n }\r\n _MOVE() {\r\n if (GameManager.Instance.isgamePause)\r\n return;\r\n this.tran.translate(this.forW, false);\r\n if (this.tran.position.z >= this.tar.position.z)\r\n this.Over();\r\n }\r\n Over() {\r\n if (this.iszhong) {\r\n PlayerController.Instance.PlayerAtked();\r\n this.Des();\r\n }\r\n else {\r\n if (this.tran.position.z >= this.tar.position.z + 6)\r\n this.Des();\r\n }\r\n }\r\n Des() {\r\n PoolManager.Instance.SetDisableObject(this.selfobj);\r\n this.destroy();\r\n }\r\n onDestroy() {\r\n Laya.timer.clearAll(this);\r\n }\r\n}\r\n",
  3. "references": [
  4. "D:/GitProject/GunGang/gungang_laya/gungang/src/Util/Mathf.ts",
  5. "D:/GitProject/GunGang/gungang_laya/gungang/src/GameLogic/PoolManager.ts",
  6. "D:/GitProject/GunGang/gungang_laya/gungang/src/GameLogic/PlayerController.ts",
  7. "D:/GitProject/GunGang/gungang_laya/gungang/src/GameLogic/GameManager.ts",
  8. "D:/GitProject/GunGang/gungang_laya/gungang/src/game_module/GlobalVariable.ts"
  9. ]
  10. }