ZombieBattleControl.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { BattleEventManager } from "../../tower/base/BattleEventManager";
  2. import { BattleControl } from "../../tower/control/BattleControl";
  3. import { ZombieMapData } from "../data/ZombieMapData";
  4. import { ZombieBuffControl } from "./ZombieBuffControl";
  5. import { ZombieEnemyControl } from "./ZombieEnemyControl";
  6. import { ZombieHeroControl } from "./ZombieHeroControl";
  7. import { ZombieSkillControl } from "./ZombieSkillControl";
  8. //战斗控制类
  9. export class ZombieBattleControl extends BattleControl{
  10. map:ZombieMapData = null
  11. //英雄控制类
  12. heroControl:ZombieHeroControl = null
  13. //敌人控制类
  14. enemyControl:ZombieEnemyControl = null
  15. //buff控制类
  16. buffControl:ZombieBuffControl = null
  17. private static instanceZombie:ZombieBattleControl;
  18. static GetInstance():ZombieBattleControl{
  19. if(!ZombieBattleControl.instanceZombie){
  20. ZombieBattleControl.instanceZombie = new ZombieBattleControl();
  21. }
  22. return ZombieBattleControl.instanceZombie;
  23. }
  24. //初始化
  25. init(mapId:number){
  26. this.battleEventManager = BattleEventManager.instance
  27. this.map = ZombieMapData.GetInstance()
  28. this.heroControl = new ZombieHeroControl()
  29. this.enemyControl = new ZombieEnemyControl()
  30. this.buffControl = new ZombieBuffControl()
  31. this.map.init(mapId)
  32. this.buffControl.init()
  33. this.heroControl.init()
  34. this.enemyControl.init()
  35. ZombieSkillControl.GetInstance().init()
  36. // for(let i = 0; i < BattleUtil.TurnMax; i++){
  37. // this.update()
  38. // if(this.map.battleEnd){
  39. // break;
  40. // }
  41. // }
  42. // this.map.battleEnd = true
  43. }
  44. reset(mapId:number){
  45. this.clear()
  46. this.map.reset(mapId)
  47. this.buffControl.init()
  48. this.heroControl.init()
  49. this.enemyControl.init()
  50. //ZombieSkillControl.GetInstance().init()
  51. }
  52. }