ZombieHeroData.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { BattleDataPool } from "../../tower/data/BattleDataPool";
  2. import { BattleUtil } from "../../tower/data/BattleUtil";
  3. import { HeroData } from "../../tower/data/HeroData";
  4. import { ZombieHeroConf } from "../conf/ZombieHeroConf";
  5. import { ZombieSkillDataPool } from "./ZombieSkillData";
  6. export class ZombieHeroData extends HeroData{
  7. init(typeID:number, level:number, posID: number) {
  8. super._init();
  9. this.level = level;
  10. this.typeID = typeID;
  11. this.posID = posID;
  12. //读地图
  13. this.position = new BattleUtil.Vector2(0, 0);
  14. let heroConf = ZombieHeroConf.data[typeID]
  15. if (heroConf) {
  16. this.attackType = heroConf.AttackType;
  17. this._speed = heroConf.Speed;
  18. this.coolDown = this._speed
  19. this._attackRadius = heroConf.Radius;
  20. this._attackDamage = heroConf.Damage;
  21. this._critical = heroConf.Critical;
  22. this._criticalDamage = heroConf.CriticalDamage;
  23. this.skillList = heroConf.SkillArray
  24. for (let i = 0; i < this.skillList.length; i++) {
  25. let skillID = this.skillList[i];
  26. let skillData = ZombieSkillDataPool.getObject();
  27. skillData.init(skillID, this);
  28. this.skillDataList.push(skillData);
  29. }
  30. this.updataLevel()
  31. return this;
  32. }
  33. return null;
  34. }
  35. }
  36. export let ZombieHeroDataPool = new BattleDataPool(ZombieHeroData,30)