Enemy.ts 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. import { _decorator, Node, Tween, Vec3, ProgressBar, UIOpacity, tween, Label, SkeletalAnimation, Animation, SphereCollider, CylinderCollider, MeshCollider, Collider} from 'cc';
  2. import { Game } from './Game';
  3. import { Player } from './Player';
  4. import { Utils } from '../utils/Utils';
  5. import { ResUtil } from '../utils/ResUtil';
  6. import MsgHints from '../utils/MsgHints';
  7. import { userIns } from '../data/UserData';
  8. import { autoBind } from '../extend/AutoBind';
  9. import { BaseExp } from '../core/base/BaseExp';
  10. import { GunBase } from '../items/base/GunBase';
  11. import { PoolManager } from '../core/manager/PoolManager';
  12. import { audioMgr } from '../core/manager/AudioManager';
  13. import { Constants } from '../data/Constants';
  14. const { ccclass, property } = _decorator;
  15. //部位类型
  16. export enum EPartType {
  17. head = "headCollider", //头部的碰撞体
  18. body = "bodyCollider", //身体的碰撞体
  19. tank = "tankCollider", //坦克的碰撞体
  20. shield = "shieldCollider", //盾的碰撞体
  21. sundries = "sundriesCollider", //杂物的碰撞体
  22. }
  23. //敌人动作类型
  24. export enum EAnimType {
  25. idle = "idle", //idle 待机状态
  26. die = "die", //die 死亡状态
  27. shoot = "shoot", //shoot 射击状态
  28. walk = "walk", //shoot 行走状态
  29. }
  30. //敌人类型枚举
  31. export enum EnemyType {
  32. SoldierPistol = 10001, // 大兵 - 普通士兵,使用手枪
  33. SniperSoldier = 10002, // 狙击兵 - 远程攻击单位,使用狙击枪
  34. ShieldSoldier = 10003, // 盾牌兵 - 高生命值防御单位,使用手枪和盾牌
  35. SnipeCaptain = 20001, // 狙击队长 - BOSS单位,使用强力狙击枪
  36. ScatterCaptain = 20002, // 机枪队长 - BOSS单位,使用高射速机关枪
  37. Tank = 20003, // 坦克 - BOSS单位,高生命值重型单位
  38. GeneralPistol = 20004 // 将军 - BOSS单位,综合型强力敌人
  39. }
  40. //武器类型枚举
  41. export enum WeaponType {
  42. Pistol = 1001, // 大兵手枪 将军手枪
  43. Sniper = 1002, // 狙击兵狙击枪 狙击队长狙击枪
  44. Shield = 1003, // 盾牌兵盾牌
  45. Scatter = 1005, // 机枪队长机关枪
  46. Tank_Pao = 1006, // 坦克
  47. }
  48. @ccclass('Enemy')
  49. export class Enemy extends BaseExp {
  50. @autoBind({type: ProgressBar,tooltip: "敌人血量"})
  51. public hpBar: ProgressBar = null!;
  52. @autoBind({type: Node,tooltip: "敌人受伤节点"})
  53. public hurt_num: Node = null!;
  54. @autoBind({type: Collider,tooltip: "敌人头部"})
  55. public headCollider: Collider = null!;
  56. @autoBind({type: Collider,tooltip: "敌人身体"})
  57. public bodyCollider: Collider = null!;
  58. @autoBind({type: Collider,tooltip: "坦克身体"})
  59. public tankCollider: Collider = null!;
  60. @autoBind({type: Node,tooltip: "坦克行走"})
  61. public tank_walk: Node = null!;
  62. @autoBind({type: Node,tooltip: "坦克射击"})
  63. public tank_shoot: Node = null!;
  64. //浓烟节点 只有军车的时候血量低于30%才会有
  65. public heavySmoke: Node = null;
  66. //敌人动画节点
  67. private skeletalAnim: SkeletalAnimation = null!;
  68. //根据敌人类型动态获取
  69. public enemyNode: Node = null!;
  70. public defaultSpeed: number = 0;
  71. public speed: number = 0;
  72. public isDead: boolean = false;
  73. //拥有的枪
  74. public gun: GunBase = null;
  75. //盾的节点
  76. public shieldNode: Node = null!;
  77. //拥有的盾可以使用的血量
  78. private _shieldHp: number = 0;
  79. public set shieldHp(value: number) {
  80. this._shieldHp = value;
  81. if(this._shieldHp <= 0){
  82. this.removeShield();
  83. }
  84. }
  85. public get shieldHp(): number {
  86. return this._shieldHp;
  87. }
  88. //当前金币的值
  89. public goldCount : number = 0;
  90. //玩家
  91. public player: Player = null!;
  92. //运动方向
  93. public moveDir: Vec3 = new Vec3();
  94. //设置的血量
  95. public curHP: number = 0;
  96. //敌人的原始血量
  97. public originHP: number = 0;
  98. //是否是没打死逃逸
  99. public escape: boolean = false;
  100. //敌人数据
  101. public data: any = null;
  102. //是否能锁定攻击对象了
  103. public isCanLock: boolean = false;
  104. //是否是在开火
  105. private isFire: boolean = false;
  106. //减血的时候是否是打到头
  107. public isShotHead: boolean = false;
  108. //敌人行走的路径
  109. public pathList: Array<Vec3> = [];
  110. //当前行走的位置
  111. public curMoveIndex: number = 0;
  112. //枪旋转角度
  113. public angle: number = 0;
  114. //新增警戒状态属性
  115. public isAlert: boolean = false;
  116. start() {
  117. this.hurt_num.active = false;
  118. }
  119. /**
  120. * 初始化数据
  121. */
  122. public async init(data: any){
  123. this.data = data;
  124. this.player = Game.I.player.getComponent(Player);
  125. const isTank:boolean = this.isTank();
  126. this.enemyNode = this.node.getChildByName(data.prb_name);
  127. if(isTank){
  128. this.tankCollider["args"] = [EPartType.tank,this];
  129. }else{
  130. this.headCollider["args"] = [EPartType.head,this];
  131. this.bodyCollider["args"] = [EPartType.body,this];
  132. this.skeletalAnim = this.enemyNode.getComponent(SkeletalAnimation);
  133. if(this.skeletalAnim){
  134. this.skeletalAnim?.play(EAnimType.idle);
  135. }
  136. }
  137. if(!this.enemyNode){
  138. MsgHints.show(`不存在:${JSON.stringify(data)}`)
  139. return;
  140. }
  141. this.isShotHead = false;
  142. this.isAlert = false;
  143. this.data = this.enemyData(data);
  144. this.isDead = false;
  145. this.escape = false;
  146. //设置血量
  147. this.curHP = this.originHP = data.hp;
  148. //敌人速度
  149. const s: number = data.speed * 3;
  150. this.speed = s;
  151. this.defaultSpeed = s;
  152. //设置枪的数据
  153. await this.createGun();
  154. //恢复初始雪条
  155. this.hpBar.progress = 1;
  156. this.hpBar.node.active = false;
  157. this.endFire();
  158. this.schedule(this.updateAAAA.bind(this),0.016199);
  159. }
  160. /**
  161. * 把武器的参数带到敌人身上
  162. */
  163. public enemyData(data:any){
  164. if(!data)return;
  165. //主武器id
  166. const mainWeaponID:number = data.weapon_id_1;
  167. let hp: number = Utils.clone(data).hp;
  168. let gData:any = userIns.enemyWeaponTable.find(e=>e.gun_id == mainWeaponID);
  169. //副武器 盾上的血量
  170. const secondWeaponID:number = data.weapon_id_2;
  171. if(secondWeaponID != 0){
  172. let sData:any = userIns.enemyWeaponTable.find(e=>e.gun_id == secondWeaponID);
  173. if(sData && sData.hp > 0){
  174. data.hp += hp + sData.shield_hp;
  175. }
  176. }
  177. return Object.assign(data,gData);
  178. }
  179. /**
  180. * 创建英雄所拥有的枪
  181. */
  182. public async createGun(){
  183. this.removeGun();
  184. //敌人主武器
  185. let gunPos:Node = this.enemyNode.getChildByName("gun_pos");
  186. const mainWeaponID:number = this.data.weapon_id_1;
  187. let mData:any = userIns.enemyWeaponTable.find(e=>e.gun_id == mainWeaponID);
  188. let gunNode:Node = await ResUtil.loadRes(`enemy/gun/${mData.gun_prb_name}`,this.enemyNode) as Node;
  189. this.gun = gunNode.getComponent(GunBase);
  190. gunNode.active = true;
  191. gunNode.parent = gunPos.parent;
  192. gunNode.worldPosition = gunPos.worldPosition.clone();
  193. gunNode.eulerAngles = gunPos.eulerAngles.clone();
  194. this.gun.init(this.data,this);
  195. //敌人附武器
  196. const secondWeaponID:number = this.data.weapon_id_2;
  197. if(secondWeaponID != 0){
  198. let sData:any = userIns.enemyWeaponTable.find(e=>e.gun_id == secondWeaponID);
  199. let shieldNode:Node = await ResUtil.loadRes(`enemy/gun/${sData.gun_prb_name}`,this.enemyNode) as Node;
  200. let shieldPos:Node = this.enemyNode.getChildByName("shield_pos");
  201. shieldNode.active = true;
  202. shieldNode.parent = shieldPos.parent;
  203. shieldNode.worldPosition = shieldPos.worldPosition.clone();
  204. shieldNode.eulerAngles = shieldPos.eulerAngles.clone();
  205. shieldNode.children[0].getComponent(Collider)["args"] = [EPartType.shield,this];
  206. this.shieldNode = shieldNode;
  207. this.shieldHp = sData.shield_hp;
  208. }
  209. }
  210. /**
  211. * 移除枪回收武器的时候调用
  212. */
  213. public removeGun(){
  214. if(this.gun){
  215. this.gun.endFire();
  216. PoolManager.putNode(this.gun.node);
  217. this.gun = null;
  218. }
  219. this.isFire = false;
  220. this.removeShield();
  221. }
  222. /**
  223. * 移除盾
  224. */
  225. public removeShield(){
  226. if(this.shieldNode){
  227. PoolManager.putNode(this.shieldNode);
  228. this.shieldNode = null;
  229. }
  230. this._shieldHp = 0;
  231. }
  232. /**
  233. * 坦克冒浓烟
  234. */
  235. public tankHeavySmoke(){
  236. if(!this.isTank())return;
  237. if(this.heavySmoke)return;
  238. //血量过低30%冒浓烟
  239. if(this.curHP < this.data.hp * 0.3){
  240. ResUtil.playParticle(
  241. `effects/Prefabs/HeavySmoke`,
  242. 0,
  243. new Vec3(0.3,0.3,0.3),
  244. (heavySmoke) => {
  245. heavySmoke.parent = this.node.parent;
  246. heavySmoke.worldPosition = this.node.worldPosition.clone();
  247. heavySmoke.active = true;
  248. this.heavySmoke = heavySmoke;
  249. }
  250. );
  251. }
  252. }
  253. /**
  254. * 扣掉血
  255. * @param hp 血
  256. * @param pData 英雄数据
  257. * @param isHeadShot 是否是爆头
  258. */
  259. public subHP(hp: number, pData:any){
  260. if(Game.I.isPause
  261. ||this.isDead
  262. ||hp == null
  263. ||this.curHP <= 0){
  264. return;
  265. }
  266. this.hpBar.node.active = true;
  267. this.scheduleOnce(() => {
  268. if(this.hpBar){this.hpBar.node.active = false;}
  269. }, 0.8);
  270. this.curHP -= hp;
  271. this.tankHeavySmoke();
  272. //这种是伤害超级高直接死亡了
  273. if(hp > this.originHP){
  274. this.escape = false;
  275. this.showHurt(Utils.numberToString(hp));
  276. this.recycle()
  277. return;
  278. }
  279. //敌人死亡
  280. if(this.curHP <= 0 && !this.isDead){
  281. this.escape = false;
  282. this.recycle();
  283. }else{//进度条和单独扣血
  284. this.hpBar.progress = this.curHP / this.originHP;
  285. this.showHurt(Utils.numberToString(hp));
  286. }
  287. }
  288. /**
  289. * 开始敌人移动,面向玩家行走
  290. */
  291. public walk(points:Vec3[]) {
  292. if(points.length <= 0)return;
  293. this.curMoveIndex = 0;
  294. this.pathList = points;
  295. const time: number = 1 / this.data.speed;
  296. if(this.isTank()){
  297. this.tank_walk.active = true;
  298. this.tank_shoot.active = false;
  299. }else{
  300. ResUtil.playSkeletalAnim(this.skeletalAnim,EAnimType.walk,time);
  301. }
  302. this.updateDir(points[0].clone());
  303. }
  304. /**
  305. * 开始攻击
  306. */
  307. public beginFire(){
  308. if(this.player
  309. && !this.player.isDead
  310. && this.gun){
  311. this.isFire = true;
  312. this.gun.fire();
  313. }
  314. }
  315. /**
  316. * 结束攻击
  317. */
  318. public endFire(){
  319. this.gun.endFire();
  320. this.isFire = false;
  321. }
  322. /**
  323. * 回收敌人节点
  324. * @param f 是否是游戏进行中的正常回收 程序主动回收不参数个数统计和加分这些
  325. * @returns
  326. */
  327. public recycle(f: boolean = true){
  328. if(!this.node
  329. ||this.isDead){
  330. return;
  331. };
  332. if(f){//爆头击杀播放音效
  333. audioMgr.playOneShot(this.isShotHead ? Constants.audios.head_shot : Constants.audios.enemy_die);
  334. }
  335. this.removeGun();
  336. this.curHP = 0;
  337. //动画和回收时间
  338. let recycleTime: number = 2;
  339. if(!this.isTank()){
  340. ResUtil.playSkeletalAnim(this.skeletalAnim,EAnimType.die);
  341. }else{
  342. //坦克爆炸后生成爆炸特效
  343. ResUtil.playParticle(
  344. `effects/Prefabs/TankBoom`,
  345. 3,
  346. new Vec3(0.1,0.1,0.1),
  347. (particle) => {
  348. particle.parent = this.node.parent;
  349. particle.worldPosition = this.node.worldPosition.clone();
  350. particle.active = true;
  351. },
  352. () => {//爆炸完成后 回收浓烟
  353. if(this.heavySmoke && this.heavySmoke.parent){
  354. PoolManager.putNode(this.heavySmoke);
  355. this.heavySmoke = null;
  356. }
  357. }
  358. );
  359. recycleTime = 3;
  360. }
  361. this.isDead = true;
  362. this.hpBar.node.active = false;
  363. let death: Function = function(inite: boolean){
  364. this.node.getComponent(UIOpacity).opacity = 255;
  365. PoolManager.putNode(this.node);
  366. if(inite){
  367. Game.I.buildEnemys.subtractEnemy(this);
  368. }
  369. }.bind(this,f);
  370. this.unschedule(death)
  371. this.scheduleOnce(death,recycleTime);
  372. }
  373. /**
  374. * 展示敌人受到的伤害
  375. * @param hpStr
  376. */
  377. public showHurt(hpStr: string) {
  378. if(Game.I.isGameOver || this.isDead) return;
  379. //创建3D伤害数字
  380. const n = PoolManager.getNode(this.hurt_num, this.hurt_num.parent);
  381. let label:Label = n.getComponent(Label);
  382. label.color = Utils.hexColor(this.isShotHead ? "#F51414" : "#FFFFFF");
  383. label.string = hpStr;
  384. const oPos: Vec3 = this.hpBar.node.position.clone();
  385. n.position = oPos;
  386. const oScale: Vec3 = this.hurt_num.scale.clone();
  387. n.scale = oScale;
  388. n.getComponent(UIOpacity).opacity = 255;
  389. let bezier: Vec3[] = [];
  390. let num: number = 100;
  391. let forward = Utils.getRandomFloat(0, 1) > 0.5 ;
  392. if (forward) {
  393. bezier = [new Vec3(-(10/num)+oPos.x, (30/num)+oPos.y), new Vec3((-40/num)+oPos.x, (40/num)+oPos.y), new Vec3((-60/num)+oPos.x, oPos.y)];
  394. } else {
  395. bezier = [new Vec3((10/num)+oPos.x, (30/num)+oPos.y), new Vec3((40/num)+oPos.x, (40/num)+oPos.y), new Vec3((60/num)+oPos.x, oPos.y)];
  396. }
  397. n.position = new Vec3(bezier[2].x,bezier[2].y - (80/num),oPos.z);
  398. //贝塞尔曲线坐标函数
  399. let twoBezier = (t: number, p1: Vec3, cp: Vec3, p2: Vec3) => {
  400. let x = (1 - t) * (1 - t) * p1.x + 2 * t * (1 - t) * cp.x + t * t * p2.x;
  401. let y = (1 - t) * (1 - t) * p1.y + 2 * t * (1 - t) * cp.y + t * t * p2.y;
  402. return new Vec3(x, y, oPos.z);
  403. };
  404. let time: number = 0.65;
  405. tween(n)
  406. .parallel(
  407. tween()
  408. .to(time,{ scale: new Vec3(oScale.x * 0.4,oScale.y * 0.4,oScale.z * 0.4)}),
  409. tween()
  410. .to(time, bezier[2], {
  411. onUpdate: (target: Vec3, ratio: number) => {
  412. if(n.parent){
  413. const pos: Vec3 = twoBezier(ratio, bezier[0], bezier[1], bezier[2]);
  414. n.position = new Vec3(pos.x,pos.y - (80/num),oPos.z)
  415. }
  416. }
  417. })
  418. ).call(function(){
  419. tween(this.getComponent(UIOpacity))
  420. .to(0.15,{opacity: 0})
  421. .call(()=>{
  422. PoolManager.putNode(this);
  423. })
  424. .start();
  425. }.bind(n)).start();
  426. }
  427. /**
  428. * 计算是否命中玩家
  429. * @returns 返回命中状态
  430. */
  431. public calculateIsHit():boolean{
  432. let isGuaranteedHit: boolean = false;
  433. //获取射击的精准度
  434. const data:any = this.getDifficultyData();
  435. //生成0-1随机数用于命中判定 根据precision范围确定命中逻辑
  436. const random = Math.random();
  437. if(data.precision < 0){//负值100%不命中
  438. isGuaranteedHit = false;
  439. }else if(data.precision > 1) {//超过1 100%命中
  440. isGuaranteedHit = true;
  441. }else {//正常范围:随机判定
  442. isGuaranteedHit = random <= data.precision;
  443. }
  444. return isGuaranteedHit;
  445. }
  446. /**
  447. * 轻松杀敌增加游戏难度 只有单其他附加因素 例如:连杀等叠加状态 给敌人增加血
  448. */
  449. public addDiffHP(){
  450. if(!this.node
  451. ||this.isDead
  452. ||Game.I.isGameOver
  453. ||this.isDead){
  454. return;
  455. };
  456. const data:any = this.getDifficultyData();
  457. if(data.hp_ratio > 0){
  458. this.curHP += this.originHP * data.hp_ratio;
  459. }
  460. }
  461. /**
  462. * 敌人的射击的精准度 获得难度数据
  463. */
  464. public getDifficultyData(): any{
  465. //获取基础精准度(玩家预设值)
  466. const precision: number = userIns.getCurLevelData().precision;
  467. let basePrecision: number = precision;
  468. let diff:any = {
  469. precision: precision,//增加或减少的精准度 0-100%
  470. hp_ratio: 0,//增加或减少的血量 0-100%
  471. reaction_time: 0,//增加或减少的反应时间 0-100%
  472. }
  473. const each: number = Math.floor(Game.I.buildEnemys.getCurKillNum() / 3);
  474. //连杀3个敌人的次数 AI精准度增加1%
  475. diff.precision += each * 0.01;
  476. //连续通关3次以上才有的难度
  477. const lx_num: number = 3;
  478. if(userIns.passNum > lx_num){//1、连续通关 AI生命值增加15% 精准度增加5%
  479. diff.precision += userIns.passNum * 0.05;
  480. diff.precision = Math.min(basePrecision, 0.9);
  481. diff.hp_ratio += userIns.passNum * 0.15;
  482. diff.hp_ratio = Math.min(diff.hp_ratio, 1);
  483. }else{//2、通关失败 下一局 AI精准度下降5% AI反应时间增加0.5s
  484. diff.precision -= userIns.passNum * 0.05;
  485. diff.precision = Math.max(diff.precision, 0.1);
  486. diff.reaction_time += 0.5;
  487. }
  488. return diff;
  489. }
  490. /**
  491. * 更新敌人行走和变化方向
  492. */
  493. protected updateAAAA(dt: number): void {
  494. if(Game.I.isGameOver
  495. || Game.I.isPause
  496. || !this.data
  497. || this.isDead) return;
  498. const targetPos = this.pathList[this.curMoveIndex];
  499. if(!targetPos)return;
  500. //保持速度调节逻辑
  501. dt = dt / Game.I.map.multiplySpeed();
  502. const currentPos = this.node.worldPosition.clone();
  503. const toTarget = targetPos.clone().subtract(currentPos);
  504. //敌人移动
  505. const moveDir = new Vec3();
  506. Vec3.subtract(moveDir, targetPos, currentPos);
  507. let distance:number = moveDir.length();
  508. //计算实际应移动距离
  509. const moveDistance = this.speed * dt;
  510. if(moveDistance > 0) {
  511. //使用标准化方向向量 + 实际移动距离
  512. const newPos = currentPos.add(toTarget.normalize().multiplyScalar(moveDistance));
  513. //添加移动平滑过渡 平滑系数 10-15比较好 值越大越平滑
  514. const smoothFactor = 20;
  515. this.node.worldPosition = Vec3.lerp(
  516. new Vec3(),
  517. currentPos,
  518. newPos,
  519. Math.min(1, dt * smoothFactor)
  520. );
  521. //更新方向
  522. const isLastPathPoint = this.curMoveIndex == this.pathList.length - 1;
  523. const dirTarget = isLastPathPoint
  524. ? Game.I.player.node.worldPosition
  525. : this.pathList[this.curMoveIndex + 1];
  526. this.updateDir(dirTarget);
  527. }
  528. //到达判断增加缓冲范围
  529. if(moveDistance > distance) {
  530. //从出生点走到第二个点就是外门第一个点就开门 并且门没有被打开
  531. if(this.curMoveIndex == 1
  532. && !Game.I.buildEnemys.isOpenDoor){
  533. Game.I.map.openDoor();
  534. Game.I.buildEnemys.isOpenDoor = true;
  535. }
  536. this.curMoveIndex++;
  537. if (this.curMoveIndex >= this.pathList.length) {
  538. this.beginFire();
  539. if(this.isTank()){
  540. this.tank_walk.active = false;
  541. this.tank_shoot.active = true;
  542. } else {
  543. ResUtil.playSkeletalAnim(this.skeletalAnim, EAnimType.shoot, this.data.atk_speed);
  544. }
  545. this.updateDir(Game.I.player.node.worldPosition);
  546. }
  547. }
  548. }
  549. /**
  550. * 更新敌人方向(根据目标坐标转向)
  551. * @param targetPos 目标坐标(路径点或玩家坐标)
  552. */
  553. public updateDir(targetPos: Vec3){
  554. const curPos = this.node.worldPosition.clone();
  555. //从目标位置指向当前位置
  556. const targetDir = Vec3.subtract(new Vec3(), curPos, targetPos);
  557. targetDir.normalize();
  558. //平滑插值转向 避免瞬间转向
  559. const currentDir = this.node.forward.clone();
  560. Vec3.slerp(currentDir, currentDir, targetDir, 0.15);
  561. this.node.forward = currentDir;
  562. }
  563. /**
  564. * 是否是坦克
  565. */
  566. public isTank():boolean{
  567. return this.data.id == EnemyType.Tank;
  568. }
  569. }