public virtual void Initialize(TowerStat stat, bool tutoLevelCero = false) { isInitialized = true; pMyStat = stat; _fireRateAux = pMyStat.fireCooldown; InitAtkRangeSprite(); pIsTutoLevelCero = tutoLevelCero; }
//for editor, when updating upgrade stat public void UpdateTowerUpgradeStat(int size) { TowerStat[] temp=upgradeStat; if(temp.Length==0){ temp=new TowerStat[1]; temp[0]=new TowerStat(); temp[0].slow=new Slow(); temp[0].dot=new Dot(); temp[0].buff=new BuffStat(); } upgradeStat=new TowerStat[size]; for(int i=0; i<upgradeStat.Length; i++){ if(i>=temp.Length) upgradeStat[i]=temp[temp.Length-1].Clone(); else upgradeStat[i]=temp[i]; } }
public TowerStat Clone() { TowerStat clone=new TowerStat(); clone.cost=cost; //clone.costs=costs; clone.costs=new int[costs.Length]; for(int i=0; i<costs.Length; i++){ clone.costs[i]=costs[i]; } clone.damage=damage; clone.cooldown=cooldown; clone.clipSize=clipSize; clone.reloadDuration=reloadDuration; clone.range=range; clone.minRange=minRange; clone.aoeRadius=aoeRadius; clone.stunDuration=stunDuration; clone.slow=slow.Clone(); clone.dot=dot.Clone(); clone.buff=buff.Clone(); //clone.incomes=incomes; clone.incomes=new int[incomes.Length]; for(int i=0; i<incomes.Length; i++){ clone.incomes[i]=incomes[i]; } clone.buildDuration=buildDuration; return clone; }