private void ModifyUnitStats(UnitStat tgtStats, UnitStat srcStats) { tgtStats.damageMin += srcStats.damageMin; tgtStats.cooldown += srcStats.cooldown; tgtStats.clipSize += srcStats.clipSize; tgtStats.reloadDuration += srcStats.reloadDuration; tgtStats.attackRange += srcStats.attackRange; tgtStats.aoeRadius += srcStats.aoeRadius; tgtStats.hit += srcStats.hit; tgtStats.dodge += srcStats.dodge; tgtStats.shieldBreak += srcStats.shieldBreak; tgtStats.shieldPierce += srcStats.shieldPierce; tgtStats.crit.chance += srcStats.crit.chance; tgtStats.crit.dmgMultiplier += srcStats.crit.dmgMultiplier; tgtStats.stun.chance += srcStats.stun.chance; tgtStats.stun.duration += srcStats.stun.duration; tgtStats.slow.duration += srcStats.slow.duration; tgtStats.slow.slowMultiplier += srcStats.slow.slowMultiplier; tgtStats.dot.duration += srcStats.dot.duration; tgtStats.dot.interval += srcStats.dot.interval; tgtStats.dot.value += srcStats.dot.value; tgtStats.instantKill.chance += srcStats.instantKill.chance; tgtStats.instantKill.HPThreshold += srcStats.instantKill.HPThreshold; }
public virtual void InitTower(int ID) { Init(); gameObject.SetActive(true); instanceID = ID; transform.Rotate(Vector3.up, -90); value = stats[CurrentActiveStat].cost; int rscCount = ResourceManager.GetResourceCount(); for (int i = 0; i < stats.Count; i++) { UnitStat stat = stats[i]; stat.slow.effectID = instanceID; stat.dot.effectID = instanceID; stat.buff.effectID = instanceID; if (stat.rscGain.Count != rscCount) { while (stat.rscGain.Count < rscCount) { stat.rscGain.Add(0); } while (stat.rscGain.Count > rscCount) { stat.rscGain.RemoveAt(stat.rscGain.Count - 1); } } } ActivateRoutine(); }
protected virtual void DrawStat(UnitStat stat) { DrawMask("Target Mask:", ref stat.customMask); DrawFloat("Damage min:", ref stat.damageMin); DrawFloat("Damage max:", ref stat.damageMax); DrawFloat("Attack range:", ref stat.attackRange); DrawFloat("AOE radius:", ref stat.aoeRadius); //DrawGameObject<ShootObject>("Shoot Object:", ref DrawListObject <ShootObject>("ShootObjects:", "SO", stat.shootObjects); }
protected void DrawUnitGUI() { Unit unit = (Unit)target; DrawFoldOut("Unit Essential:", () => { if (DrawToggle("Set Custom Layer: ", ref unit.useCustomLayer)) { DrawLayer("Custom Layer", ref unit.customLayer); } DrawTextfield("Unit name:", ref unit.unitName); DrawTransform("Target point:", unit.targetPoint); unit.hitedEffect = DrawGameObject("Hitted Effect:", unit.hitedEffect); DrawFloat("Hitpoint:", ref unit.HP); DrawFloat("Max HP:", ref unit.fullHP); DrawFloat("Shield:", ref unit.shield); DrawSlider("Hit Threshold:", ref unit.hitThreshold, .2f, .5f); unit.behaviour = (Behaviour)EditorGUILayout.EnumPopup("Behaviour: ", unit.behaviour); }); DrawFoldOut("Attack Behavior:", () => { DrawFloat("Detect range: ", ref unit.detectRange); bool showFoldOut = unit.stats.Count > 1; if (showFoldOut) { for (int i = 0; i < unit.stats.Count; i++) { UnitStat stat = unit.stats[i]; DrawFoldOut("Stat " + i, () => { DrawStat(stat); }); } } else { DrawStat(unit.stats[0]); } showFoldOut = unit.shootPoints.Count > 0; if (showFoldOut) { for (int i = 0; i < unit.shootPoints.Count; i++) { Transform sp = unit.shootPoints[i]; unit.shootPoints[i] = DrawTransform("ShootPoint " + i, sp); } } else { DrawStat(unit.stats[0]); } }); }
public UnitStat Clone() { UnitStat stat = new UnitStat(); stat.shootObjects = new List <ShootObject>(shootObjects); stat.icon = icon; stat.abilityHolder = abilityHolder; stat.customMask = customMask; stat.damageMin = damageMin; stat.damageMax = damageMax; stat.clipSize = clipSize; stat.reloadDuration = reloadDuration; stat.minRange = minRange; stat.attackRange = attackRange; stat.aoeRadius = aoeRadius; stat.hit = hit; stat.dodge = dodge; stat.shieldBreak = shieldBreak; stat.shieldPierce = shieldPierce; stat.damageShieldOnly = damageShieldOnly; stat.crit = crit.Clone(); stat.stun = stun.Clone(); stat.slow = slow.Clone(); stat.dot = dot.Clone(); stat.instantKill = instantKill.Clone(); stat.buff = buff.Clone(); stat.buildDuration = buildDuration; stat.unBuildDuration = unBuildDuration; stat.shootObjectT = shootObjectT; stat.desp = desp; //stat.despGeneral=despGeneral; //for(int i=0; i<rscGain.Count; i++) stat.rscGain.Add(rscGain[i]); //for(int i=0; i<cost.Count; i++) stat.cost.Add(cost[i]); stat.rscGain = new List <int>(rscGain); stat.cost = new List <int>(cost); return(stat); }
public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitTower tower, UnitCreep creep) { List <Rsc> rscList = EditorDBManager.GetRscList(); float width = 150; float fWidth = 35; float spaceX = 130; float height = 18; float spaceY = height + 2; //startY-=spaceY; GUI.Box(new Rect(startX + 10, startY + 20, 220, statContentHeight - startY), ""); startX += 20; startY += 25; if (tower && tower.IsHero()) { //stat.icon = EditorGUI.ObjectField(new Rect(startX + 100, startY + 20, 60, 60), stat.icon, typeof(Sprite)) as Sprite; //startX += 20; startY += 85; cont = new GUIContent("Ability:", "Istrumination"); EditorGUI.LabelField(new Rect(startX, startY, 50, spaceY), cont); stat.abilityHolder = EditorGUI.ObjectField(new Rect(startX + 80, startY, 105, spaceY), stat.abilityHolder, typeof(AbilityBehavior)) as AbilityBehavior; startX += 0; startY += spaceY; } if (tower != null) { cont = new GUIContent("Construct Duration:", "The time in second it takes to construct (if this is the first level)/upgrade (if this is not the first level)"); EditorGUI.LabelField(new Rect(startX, startY, width, height), cont); stat.buildDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buildDuration); cont = new GUIContent("Deconstruct Duration:", "The time in second it takes to deconstruct if the unit is in this level"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.unBuildDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.unBuildDuration); if (stat.cost.Count != rscList.Count) { while (stat.cost.Count > rscList.Count) { stat.cost.RemoveAt(stat.cost.Count - 1); } while (stat.cost.Count < rscList.Count) { stat.cost.Add(0); } } cont = new GUIContent("Build/Upgrade Cost:", "The resource required to build/upgrade to this level"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); int count = 0; startY += spaceY; float cachedX = startX; for (int i = 0; i < rscList.Count; i++) { EditorUtilities.DrawSprite(new Rect(startX + 10, startY - 1, 20, 20), rscList[i].icon); stat.cost[i] = EditorGUI.IntField(new Rect(startX + 30, startY, fWidth, height), stat.cost[i]); count += 1; startX += 65; if (count == 3) { startY += spaceY; startX = cachedX; } } startX = cachedX; startY += 5; startY += spaceY + 5; } //if(tower && tower.IsHero()) //{ // cont = new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned."); // EditorGUI.LabelField(new Rect(startX, startY, width, height), cont); // stat.shootObject = (ShootObject)EditorGUI.ObjectField(new Rect(startX + spaceX - 50, startY, width-20, height), stat.shootObject, typeof(ShootObject)); // startY += spaceY; //} //else if ((tower && TowerUseShootObject(tower)) || (creep && creep.type == _CreepType.Offense)) { if (stat.shootObjects.Count == 0 && stat.shootObject) { stat.shootObjects.Add(stat.shootObject); } cont = new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned."); EditorGUI.LabelField(new Rect(startX, startY, width, height), cont); Vector2 Start = EditorUtilities.DrawButton(new Rect(startX, startY + 15, 30, height), Vector2.zero, "+", () => { if (stat.shootObjects.Count > 0 && stat.shootObjects[stat.shootObjects.Count - 1]) { stat.shootObjects.Add(stat.shootObjects[stat.shootObjects.Count - 1]); //clone the last one } else { stat.shootObjects.Add(null); } }); EditorUtilities.DrawButton(new Rect(startX + 31, startY + 15, 30, height), Vector2.zero, "-", () => { if (stat.shootObjects.Count > 1) { stat.shootObjects.RemoveAt(stat.shootObjects.Count - 1); } }); if (stat.shootObjects.Count < 2) { startY = Start.y; } if (stat.shootObjects.Count == 1) { startY -= height; } for (int i = 0; i < stat.shootObjects.Count; i++) { stat.shootObjects[i] = (ShootObject)EditorGUI.ObjectField(new Rect(startX + spaceX - 50, startY, 4 * fWidth - 20, height), stat.shootObjects[i], typeof(ShootObject), false); startY += spaceY; } } cont = new GUIContent("Target layer:", ""); EditorGUI.LabelField(new Rect(startX, startY, width, height), cont); stat.customMask = EditorUtilities.LayerMaskField(new Rect(startX + spaceX - 50, startY, 4 * fWidth - 20, height), "", stat.customMask); startY += 5; if (tower && TowerUseShootObjectT(tower)) { cont = new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned."); EditorGUI.LabelField(new Rect(startX, startY, width, height), cont); stat.shootObjectT = (Transform)EditorGUI.ObjectField(new Rect(startX + spaceX - 50, startY, 4 * fWidth - 20, height), stat.shootObjectT, typeof(Transform), false); startY += 5; } if ((tower && TowerDealDamage(tower)) || (creep && creep.type == _CreepType.Offense)) { cont = new GUIContent("Damage(Min/Max):", ""); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.damageMin = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.damageMin); stat.damageMax = EditorGUI.FloatField(new Rect(startX + spaceX + fWidth, startY, fWidth, height), stat.damageMax); cont = new GUIContent("Cooldown:", "Duration between each attack"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.cooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.cooldown); cont = new GUIContent("Attack Range:", "Effect range of the unit"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.attackRange = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.attackRange); if (creep) { cont = new GUIContent("Detect Range:", "Detect range of the creep"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); creep.detectRange = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), creep.detectRange); } //~ cont=new GUIContent("Range(Min/Max):", ""); //~ EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont); //~ stat.minRange=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.minRange); //~ stat.range=EditorGUI.FloatField(new Rect(startX+spaceX+fWidth, startY, fWidth, height), stat.range); cont = new GUIContent("AOE Radius:", "Area-of-Effective radius. When the shootObject hits it's target, any other hostile unit within the area from the impact position will suffer the same target as the target.\nSet value to >0 to enable. "); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.aoeRadius = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.aoeRadius); cont = new GUIContent("Hit Chance:", "Take value from 0-1. 0 being 0% and 1 being 100%. Final value are subject to target's dodgeChance. Assume two targets with 0 dodgeChance and .2 dodgeChance and the hitChance set to 1, the unit will always hits the target and have 20% chance to miss the second target."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.hit = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.hit); if (!creep) { cont = new GUIContent("Dodge Chance:", "Take value from 0-1. 0 being 0% and 1 being 100%. Final value are subject to target's hitChance. Assume two attackers with 1 hitChance and .8 hitChance and the dodgeChance set to .2, the chances to dodge attack from each attacker are 20% and 40% respectively."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.dodge = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dodge); } cont = new GUIContent("Stun", ""); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY; cont = new GUIContent(" - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.stun.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.stun.chance); cont = new GUIContent(" - Duration:", "The stun duration in second"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.stun.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.stun.duration); cont = new GUIContent("Critical", ""); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY; cont = new GUIContent(" - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.crit.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.crit.chance); cont = new GUIContent(" - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.crit.dmgMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.crit.dmgMultiplier); cont = new GUIContent("Slow", ""); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY; cont = new GUIContent(" - Duration:", "The effect duration in second"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.slow.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.slow.duration); cont = new GUIContent(" - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.slow.slowMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.slow.slowMultiplier); cont = new GUIContent("Dot", "Damage over time"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY; cont = new GUIContent(" - Duration:", "The effect duration in second"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.dot.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.duration); cont = new GUIContent(" - Interval:", "Duration between each tick. Damage is applied at each tick."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.dot.interval = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.interval); cont = new GUIContent(" - Damage:", "Damage applied at each tick"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.dot.value = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.value); cont = new GUIContent("InstantKill", ""); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY; cont = new GUIContent(" - Chance:", "The chance to instant kill the target. Takes value from 0-1 with 0 being 0% and 1 being 100%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.instantKill.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.instantKill.chance); cont = new GUIContent(" - HP Threshold:", "The HP threshold of the target in order for the instantKill to become valid. Take value from 0-1 with 0.3 being 30% of the fullHP."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.instantKill.HPThreshold = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.instantKill.HPThreshold); cont = new GUIContent("Damage Shield Only:", "When checked, unit will only inflict shield damage"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.damageShieldOnly = EditorGUI.Toggle(new Rect(startX + spaceX, startY, fWidth, height), stat.damageShieldOnly); cont = new GUIContent("Shield Break:", "The chance of the unit's attack to damage target's shield and disable shield regen permenantly\nTakes value from 0-1 with 0 being 0% and 1 being 100%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.shieldBreak = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.shieldBreak); cont = new GUIContent("Shield Pierce:", "The chance of the unit's attack to bypass target's shield and damage HP directly\nTakes value from 0-1 with 0 being 0% and 1 being 100%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.shieldPierce = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.shieldPierce); } if ((tower && tower.type == _TowerType.Support) || (creep && creep.type == _CreepType.Support)) { cont = new GUIContent("Range:", "Effect range of the unit"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.attackRange = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.attackRange); startY += 5; cont = new GUIContent("Buff:", "Note: Buffs from multple tower doesnt stack, however when there's difference in the buff strength, the stronger buff applies. A tower can gain maximum dmage buff from one source and maximum range buff from another"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY; cont = new GUIContent(" - Damage:", "Damage buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in damage"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.buff.damageBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.damageBuff); cont = new GUIContent(" - Cooldown:", "Dooldown buff multiplier. Takes value from 0-1 with 0.2 being reduce cooldown by 20%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.buff.cooldownBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.cooldownBuff); cont = new GUIContent(" - Range:", "Range buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in range"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.buff.rangeBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.rangeBuff); cont = new GUIContent(" - Critical:", "Critical hit chance buff modifier. Takes value from 0 and above with 0.25 being 25% increase in critical hit chance"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.buff.criticalBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.criticalBuff); cont = new GUIContent(" - Hit:", "Hit chance buff modifier. Takes value from 0 and above with .2 being 20% increase in hit chance"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.buff.hitBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.hitBuff); cont = new GUIContent(" - Dodge:", "Dodge chance buff modifier. Takes value from 0 and above with 0.15 being 15% increase in dodge chance"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.buff.dodgeBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.dodgeBuff); cont = new GUIContent(" - HP Regen:", "HP Regeneration Buff. Takes value from 0 and above with 2 being gain 2HP second "); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.buff.regenHP = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.regenHP); } if (tower && tower.type == _TowerType.Resource) { if (stat.rscGain.Count != rscList.Count) { while (stat.rscGain.Count > rscList.Count) { stat.rscGain.RemoveAt(stat.rscGain.Count - 1); } while (stat.rscGain.Count < rscList.Count) { stat.rscGain.Add(0); } } cont = new GUIContent("Resource Gain:", "The resource gain by unit at each cooldown interval\nOnly applicable to ResourceTower"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); int count = 0; startY += spaceY; float cachedX = startX; for (int i = 0; i < rscList.Count; i++) { EditorUtilities.DrawSprite(new Rect(startX + 10, startY - 1, 20, 20), rscList[i].icon); stat.rscGain[i] = EditorGUI.IntField(new Rect(startX + 30, startY, fWidth, height), stat.rscGain[i]); count += 1; startX += 65; if (count == 3) { startY += spaceY; startX = cachedX; } } startX = cachedX; startY += 5; } if (tower) { startY += 10; cont = new GUIContent("Custom Description:", "Check to use use custom description. If not, the default one (generated based on the effect) will be used"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); stat.useCustomDesp = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 40, height), stat.useCustomDesp); if (stat.useCustomDesp) { GUIStyle style = new GUIStyle("TextArea"); style.wordWrap = true; stat.desp = EditorGUI.TextArea(new Rect(startX, startY + spaceY - 3, 200, 90), stat.desp, style); startY += 90; } } statContentHeight = startY + spaceY - 15; return(new Vector3(startX + 220, startY, statContentHeight)); }
public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitCreep creep) { return(DrawStat(stat, startX, startY, statContentHeight, null, creep)); }
public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitTower tower) { return(DrawStat(stat, startX, startY, statContentHeight, tower, null)); }
void MoveToAttack(Transform target, UnitStat stat) { agent.destination = target.position; agent.stoppingDistance = stat.attackRange * .9f; }
private static void RefreshRsc() { for (int i = 0; i < towerList.Count; i++) { UnitTower tower = towerList[i]; for (int n = 0; n < tower.stats.Count; n++) { UnitStat stat = tower.stats[n]; while (stat.cost.Count < rscList.Count) { stat.cost.Add(0); } while (stat.cost.Count > rscList.Count) { stat.cost.RemoveAt(stat.cost.Count - 1); } while (stat.rscGain.Count < rscList.Count) { stat.rscGain.Add(0); } while (stat.rscGain.Count > rscList.Count) { stat.rscGain.RemoveAt(stat.rscGain.Count - 1); } } } for (int i = 0; i < creepList.Count; i++) { UnitCreep creep = creepList[i]; while (creep.valueRscMin.Count < rscList.Count) { creep.valueRscMin.Add(0); } while (creep.valueRscMin.Count > rscList.Count) { creep.valueRscMin.RemoveAt(creep.valueRscMin.Count - 1); } while (creep.valueRscMax.Count < rscList.Count) { creep.valueRscMax.Add(0); } while (creep.valueRscMax.Count > rscList.Count) { creep.valueRscMax.RemoveAt(creep.valueRscMax.Count - 1); } } for (int i = 0; i < perkList.Count; i++) { Perk perk = perkList[i]; while (perk.cost.Count < rscList.Count) { perk.cost.Add(0); } while (perk.cost.Count > rscList.Count) { perk.cost.RemoveAt(perk.cost.Count - 1); } } }