public TowerPrototype(string iName, int iPrice, Sprite iTurretSprite) { _name = iName; _price = iPrice; _baseSprite = PrototypeDatabase.Active.SpriteBase; _turretSprite = iTurretSprite; _pathable = false; _attackManagerPrototype = PrototypeDatabase.Active.AttackManagerDefault; _abilityManagerPrototype = PrototypeDatabase.Active.AbilityManagerDefault; _powerManagerPrototype = PrototypeDatabase.Active.PowerManagerDefault; }
public void ApplyPrototype(TowerPrototype iPrototype) { _prototype = iPrototype; AttackManagerPrototype attackManagerPrototype = _prototype._attackManagerPrototype; AbilityManagerPrototype abilityManagerPrototype = _prototype._abilityManagerPrototype; PowerManagerPrototype powerManagerPrototype = _prototype._powerManagerPrototype; gameObject.name = _prototype._name; _attackManager.ApplyPrototype(attackManagerPrototype, abilityManagerPrototype); _powerManager.ApplyPrototype(powerManagerPrototype); SpriteRenderer baseSprite = this.GetComponent <SpriteRenderer>(); SpriteRenderer turretSprite = _turret.GetComponent <SpriteRenderer>(); baseSprite.sprite = _prototype._baseSprite; turretSprite.sprite = _prototype._turretSprite; }
public void Redraw() { if (Player.SelectedUnit != null) { Name.text = Player.SelectedUnit.gameObject.name; Image.enabled = true; Image.sprite = Player.SelectedUnit.GetComponent <SpriteRenderer>().sprite; TurretImage.enabled = false; foreach (Transform child in Player.SelectedUnit.transform) { if (child.gameObject.tag == "Turret" && child.gameObject.GetComponent <SpriteRenderer>().sprite != null) { TurretImage.enabled = true; TurretImage.sprite = child.GetComponent <SpriteRenderer>().sprite; TurretImage.transform.rotation = child.rotation; break; } } if (Player.SelectedUnit is Runner) { Runner runner = (Runner)Player.SelectedUnit; Vitals.text = "Health: " + runner._life + "/" + runner._maxLife; Vitals.color = COLOR_VITAL_LIFE; Cooldown.text = "Speed: " + runner.GetStat(Runner.MOVEMENT_SPEED); // Remember to change to mutablespeed later. Value.text = "Bounty: " + runner._bounty; Range.text = "----"; Damage.text = "----"; AbilityName.text = "----"; AbilityCooldown.text = "----"; AbilityEnergycost.text = "----"; AbilityEffect.text = "----"; AbilityTrigger.text = "----"; // Special abilities here later. Divine shield, speed, Feedback. } else if (Player.SelectedUnit is Tower) { Tower tower = (Tower)Player.SelectedUnit; PowerManager power = tower._powerManager; AttackManager attack = tower.gameObject.GetComponent <AttackManager>(); Value.text = "Value: " + tower._prototype._price; if (power._prototype._maxEnergy > 0) { // If it has energy, show it. Vitals.text = "Energy: " + power._energy + "/" + power._prototype._maxEnergy; Vitals.color = COLOR_VITAL_MANA; } if (attack._prototype != PrototypeDatabase.Active.AttackManagerDefault) { AttackManagerPrototype attackPrototype = attack._prototype; // Should be get functions instead of doing this here. if (attack != null) { // If it has an attack and hence isn't the dummy attackManager Range.text = "Range: " + UIManager.formatFloat(attackPrototype._range); float attackSpeed = tower.GetStat(Tower.ATTACK_SPEED); if (attackSpeed == 1) { Cooldown.text = "Cool: " + UIManager.formatFloat(attack._cooldownRemaining) + "/" + UIManager.formatFloat(attackPrototype._cooldown); } else { Cooldown.text = "Cool: " + UIManager.formatFloat(attack._cooldownRemaining / attackSpeed) + "/" + UIManager.formatFloat(attackPrototype._cooldown / attackSpeed); } Damage.text = "Damage: " + attackPrototype._damageDisplay; if (attack._abilityPrototype != PrototypeDatabase.Active.AbilityManagerDefault) { AbilityManagerPrototype abilityPrototype = attack._abilityPrototype as AbilityManagerPrototype; AbilityName.text = abilityPrototype._name; AbilityCooldown.text = "Cool: " + UIManager.formatFloat(attack._abilityCooldownRemaining) + "/" + UIManager.formatFloat(abilityPrototype._cooldown); AbilityEnergycost.text = "Energy: " + abilityPrototype._energyCost + "(" + UIManager.formatFloat(abilityPrototype._energyCost / abilityPrototype._cooldown, 1) + ")"; AbilityEffect.text = "Effect: " + abilityPrototype._effectDisplay; // These need better descriptions. Don't really want it to even say "Trigger" if (abilityPrototype._trigger == AbilityManagerPrototype.TRIGGER.ON_ATTACK) { AbilityTrigger.text = "Trigger: On Attack"; // Doesn't prevent normal attack } else if (abilityPrototype._trigger == AbilityManagerPrototype.TRIGGER.ON_ATTACK_OVERRIDE) { AbilityTrigger.text = "Trigger: Replace Attack"; // Prevents normal attack } else { AbilityTrigger.text = "Trigger: Constant"; // Whenever cooldown is ready } } } } else { PowerManagerPrototype powerPrototype = power._prototype as PowerManagerPrototype; // Power Geneator/Transfer Tower. Range.text = "Transfer Rate: " + UIManager.formatFloat(powerPrototype._transferRate); Cooldown.text = "Links: " + power._powerLinksIn.Count + "/" + power._powerLinksOut.Count; if (powerPrototype.isGenerator()) { Damage.text = "Production: " + powerPrototype._passiveProduction; } else if (powerPrototype.isConsumer()) { Damage.text = "Consumption: " + powerPrototype._consumptionEstimate; // Never displays. No consumes that aren't also attackers. } AbilityName.text = "----"; AbilityCooldown.text = "----"; AbilityEnergycost.text = "----"; AbilityEffect.text = "----"; AbilityTrigger.text = "----"; } } } else { Name.text = "----"; Vitals.text = "----"; Image.enabled = false; TurretImage.enabled = false; Cooldown.text = "----"; Range.text = "----"; Damage.text = "----"; Value.text = "----"; AbilityName.text = "----"; AbilityCooldown.text = "----"; AbilityEnergycost.text = "----"; AbilityEffect.text = "----"; AbilityTrigger.text = "----"; } }
// Use this for initialization void Start() { Active = this; EffectDefault = new Effect(); AttackManagerDefault = new AttackManagerPrototype(0.0f, 0.0f, 0, EffectDefault); AbilityManagerDefault = new AbilityManagerPrototype(0.0f, 0, AbilityManagerPrototype.TRIGGER.ON_ATTACK, EffectDefault); PowerManagerDefault = new PowerManagerPrototype(0, 0); Wall = new TowerPrototype("Wall Tower", 2, null); Wall._powerManagerPrototype.SetCanRecieve(false); // Rock Launcher { int[] Damage = { 31, 96, 224, 448, 960, 1680 }; // Would prefer using a function to generate. int BasePrice = 10; int BasePower = 50; int BasePowerRate = 10; for (int z = 0; z < 6; z++) { // Create a Effectdamage, and a projectile to deliver it. ProjectilePrototype projectilePrototype = new ProjectilePrototype(9.0f, new EffectDamage(Damage [z], true), SpriteProjectileCannon); // Make an EffectProjectile to throw said projectile Effect effectCreateProjectile = new EffectProjectile(projectilePrototype, false); int level = z + 1; // Make a TowerPrototype Cannon [z] = new TowerPrototype("Rock Launcher " + level, (int)LevelScale(level, BasePrice), SpriteTurretCannon); // Attach an AttackManagerPrototype to throw that effect, also display the damage. Cannon [z]._attackManagerPrototype = new AttackManagerPrototype(5.0f, 3.0f, Damage [z], effectCreateProjectile); // Attack a SpellManager. Effect effectOverclockAdd = new EffectMutableStat(Tower.ATTACK_SPEED, "overclock", 4.0f, true); Effect effectOverclockRemove = new EffectMutableStat(Tower.ATTACK_SPEED, "overclock", false); Effect effectAddbuff = new EffectBuff(new BuffPrototype(effectOverclockAdd, effectOverclockRemove, EffectDefault, 5.0f, 0f, true, "Overclock"), EffectBuff.TARGET.SELF, false); Cannon[z]._abilityManagerPrototype = new AbilityManagerPrototype(5.0f, (int)LevelScale(level, 25), AbilityManagerPrototype.TRIGGER.CONSTANT, effectAddbuff, "Overclock", "+300% Attack Speed"); // (float iCooldown, int iEnergyCost, TRIGGER iTrigger, int iDamageDisplay, Effect iEffect) // (5.0f, 25, TRIGGER.ON_ATTACK, -1, new EFFECT(Apply Buff self -cooldown, 5 second, something),"Overclock"); // Attach a PowerManagerPrototype as well, to supply power. Cannon [z]._powerManagerPrototype = new PowerManagerPrototype((int)LevelScale(level, BasePower), (int)LevelScale(level, BasePowerRate)); } for (int z = 0; z < 5; z++) { Cannon [z].SetUpgradesTo(Cannon [z + 1]); } } { // Poison Tower int[] Damage = { 20, 53, 107, 196, 341, 567 }; int[] AbilityDamage = { 33, 156, 489, 1306, 3218, 7560 }; int BasePrice = 20; int[] Power = { 150, 400, 900, 1700, 3300, 6400 }; int[] PowerCost = { 40, 115, 250, 500, 980, 1890 }; //{ 40,113,248,500,979,1890 }; int[] PowerRate = { 28, 75, 165, 333, 653, 1260 }; for (int z = 0; z < 6; z++) { // Create a Effectdamage, and a projectile to deliver it. ProjectilePrototype projectilePrototype = new ProjectilePrototype(5.0f, new EffectDamage(Damage[z], true), SpriteProjectilePoison); BuffPrototype buff = new BuffPrototype(new EffectDamage(AbilityDamage[z], false), EffectDefault, new EffectDamage(AbilityDamage[z] / 10, false), 15.1f, 1.0f, true, "Poison"); ProjectilePrototype abilityProjectilePrototype = new ProjectilePrototype(9.0f, new EffectBuff(buff, EffectBuff.TARGET.RUNNER, true), SpriteAbilityProjectilePoison); // Make an EffectProjectile to throw said projectile Effect effect = new EffectProjectile(projectilePrototype, false); Effect effectAbility = new EffectProjectile(abilityProjectilePrototype, false); int level = z + 1; // Make a TowerPrototype Poison[z] = new TowerPrototype("Posion Tower " + level, (int)LevelScale(level, BasePrice), SpriteTurretPoison); // Attach an AttackManagerPrototype to throw that effect, also display the damage. Poison[z]._attackManagerPrototype = new AttackManagerPrototype(3.5f, 0.4f, Damage [z], effect); // Attach a SpellManager. Poison[z]._abilityManagerPrototype = new AbilityManagerPrototype( 3.0f, PowerCost[z], AbilityManagerPrototype.TRIGGER.ON_ATTACK, effectAbility, "Poison", AbilityDamage[z] + "damage + " + (AbilityDamage[z] / 10) + "dps for 15sec" ); // Attach a PowerManagerPrototype as well, to supply power. Poison [z]._powerManagerPrototype = new PowerManagerPrototype(Power[z], LevelScale(level, PowerRate[z])); } for (int z = 0; z < 5; z++) { Poison [z].SetUpgradesTo(Poison [z + 1]); } } { // Slow Tower int[] Damage = { 20, 53, 107, 196, 341, 567 }; int[] AbilityDamage = { 33, 156, 489, 1306, 3218, 7560 }; // Huh, Poison and Frost have same damage. Well, sort of. int BasePrice = 15; int[] Power = { 90, 225, 450, 843, 1551, 2835 }; int[] PowerCost = { 18, 45, 105, 500, 979, 1890 }; int[] PowerRate = { 30, 75, 150, 281, 517, 945 }; float[] AbilityRange = { 0.25f, 0.375f, 0.5f, 0.625f, 0.75f, 0.875f }; // A guess, Revamp later. float[] Duration = { 2f, 4f, 7f, 11f, 16f, 21f }; for (int z = 0; z < 6; z++) { // Create a Effectdamage, and a projectile to deliver it. ProjectilePrototype projectilePrototype = new ProjectilePrototype(5.0f, new EffectDamage(Damage[z], true), SpriteProjectileFrost); Effect effectBuffAdd = new EffectMutableStat(Runner.MOVEMENT_SPEED, "slow", 0.5f, true); Effect effectBuffRemove = new EffectMutableStat(Runner.MOVEMENT_SPEED, "slow", false); Effect effectAddBuff = new EffectBuff(new BuffPrototype(effectBuffAdd, effectBuffRemove, EffectDefault, Duration[z], 0f, true, "slow"), EffectBuff.TARGET.RUNNER, false); Effect effectAOE = new EffectSplash(effectAddBuff, AbilityRange[z], Effect.TARGET.RUNNER, false); Effect effectAbilityDamage = new EffectDamage(AbilityDamage[z], true); Effect effectFork = new EffectFork(effectAOE, effectAbilityDamage, EffectDefault, EffectDefault); // Need splash effect and fork effect for this to work correctly. // On Impact, call Fork. Damage Target, and AOE on Target ->Apply Debuff ProjectilePrototype abilityProjectilePrototype = new ProjectilePrototype(9.0f, effectFork, SpriteAbilityProjectileFrost); // Make an EffectProjectile to throw said projectile Effect effect = new EffectProjectile(projectilePrototype, false); Effect effectAbility = new EffectProjectile(abilityProjectilePrototype, false); int level = z + 1; // Make a TowerPrototype Frost[z] = new TowerPrototype("Frost Tower " + level, (int)LevelScale(level, BasePrice), SpriteTurretFrost); // Attach an AttackManagerPrototype to throw that effect, also display the damage. Frost[z]._attackManagerPrototype = new AttackManagerPrototype(3.5f, 1f, Damage[z], effect); // Attach a SpellManager. Frost[z]._abilityManagerPrototype = new AbilityManagerPrototype( 1.0f, PowerCost[z], AbilityManagerPrototype.TRIGGER.ON_ATTACK, effectAbility, "Slow", "50% Slow for " + Duration[z] + "sec" ); // Attach a PowerManagerPrototype as well, to supply power. Frost[z]._powerManagerPrototype = new PowerManagerPrototype(Power[z], LevelScale(level, PowerRate[z])); } for (int z = 0; z < 5; z++) { Frost[z].SetUpgradesTo(Frost[z + 1]); } } { // Pyro Trap -- NYA int BasePrice = 25; int[] Damage = { 2, 5, 11, 24, 51, 105 }; int[] AbilityDamage = { 450, 1443, 3594, 8220, 18135, 39375 }; float Range = 1.5f; float AbilityRange = 1.75f; int[] Power = { 200, 600, 2000, 4000, 8000, 20000 }; int[] PowerCost = { 113, 356, 875, 1968, 4360, 9450 }; int[] PowerRate = { 25, 80, 194, 441, 967, 2100 }; for (int z = 0; z < 6; z++) { int level = z + 1; // Create a Splash effect that Applies a damage over time buff. EffectDamage initialDamage = new EffectDamage(AbilityDamage[z], false); EffectDamage periodicDamage = new EffectDamage(AbilityDamage[z] / 20, false); BuffPrototype buff = new BuffPrototype(initialDamage, EffectDefault, periodicDamage, 10.1f, 1.0f, true, "Pyro", "On Fire"); EffectBuff dotEffect = new EffectBuff(buff, Effect.TARGET.RUNNER, false); EffectSplash splashEffect = new EffectSplash(dotEffect, AbilityRange, Effect.TARGET.RUNNER, false); // Create a direct damage effect. EffectDamage attackDamage = new EffectDamage(Damage[z], false); // Make a TowerPrototype Pyro[z] = new TowerPrototype("Pyro Trap " + level, (int)LevelScale(level, BasePrice), null); // Attach an AttackManagerPrototype to throw that effect, also display the damage. Pyro[z]._attackManagerPrototype = new AttackManagerPrototype(Range, 1.0f, Damage [z], attackDamage); // Attack a SpellManager. Pyro[z]._abilityManagerPrototype = new AbilityManagerPrototype( 8.5f, PowerCost[z], AbilityManagerPrototype.TRIGGER.ON_ATTACK, splashEffect, "Firestorm", AbilityDamage[z] + "damage + " + (AbilityDamage[z] / 20) + "dps for 10sec in Range" ); // Attach a PowerManagerPrototype as well, to supply power. Pyro [z]._powerManagerPrototype = new PowerManagerPrototype(Power[z], LevelScale(level, PowerRate[z])); } for (int z = 0; z < 5; z++) { Pyro [z].SetUpgradesTo(Pyro [z + 1]); } } { // Flame Tower int BaseDamage = 36;// { 36, 108, 252, 540, 1116, 2268 }; int[] AbilityDamage = { 48, 135, 294, 585, 1116, 2079 }; int BasePrice = 20; int[] Power = { 120, 300, 720, 1440, 3000, 6600 }; int BasePowerCost = 15; int BasePowerRate = 40; for (int z = 0; z < 6; z++) { int level = z + 1; // Create a Effectdamage, and a projectile to deliver it. ProjectilePrototype projectilePrototype = new ProjectilePrototype(5.0f, new EffectDamage(LevelScale(level, BaseDamage), true), SpriteProjectileFlame); ProjectilePrototype abilityProjectilePrototype = new ProjectilePrototype(5.0f, new EffectDamage(LevelScale(level, BaseDamage) + AbilityDamage[z], true), SpriteAbilityProjectileFlame); // Make an EffectProjectile to throw said projectile Effect effect = new EffectProjectile(projectilePrototype, false); Effect effectAbility = new EffectProjectile(abilityProjectilePrototype, false); // Make a TowerPrototype Flame[z] = new TowerPrototype("Flame Tower " + level, LevelScale(level, BasePrice), SpriteTurretFlame); // Attach an AttackManagerPrototype to throw that effect, also display the damage. Flame[z]._attackManagerPrototype = new AttackManagerPrototype(3.0f, 0.75f, LevelScale(level, BaseDamage), effect); // Attack a SpellManager. Flame[z]._abilityManagerPrototype = new AbilityManagerPrototype( 0.75f, (int)LevelScale(level, BasePowerCost), AbilityManagerPrototype.TRIGGER.ON_ATTACK_OVERRIDE, effectAbility, "Ignite", AbilityDamage[z] + " bonus damage." ); // Attach a PowerManagerPrototype as well, to supply power. Flame [z]._powerManagerPrototype = new PowerManagerPrototype(Power[z], (int)LevelScale(level, BasePowerRate)); } for (int z = 0; z < 5; z++) { Flame [z].SetUpgradesTo(Flame [z + 1]); } } { // Lightning Tower // Temperarlly a rapid-fire attack tower because no lightning effect yet. int BaseDamage = 3; int BaseAbilityDamage = 9; //90; int BasePrice = 10; int BasePower = 160; int BasePowerCost = 2; //20; int BasePowerRate = 40; for (int z = 0; z < 6; z++) { int level = z + 1; // Create a Effectdamage, and a projectile to deliver it. ProjectilePrototype projectilePrototype = new ProjectilePrototype(5.0f, new EffectDamage(LevelScale(level, BaseDamage), true), SpriteProjectileLightning); ProjectilePrototype abilityProjectilePrototype = new ProjectilePrototype(8.0f, new EffectDamage(LevelScale(level, BaseAbilityDamage), true), SpriteAbilityProjectileLightning); // Make an EffectProjectile to throw said projectile Effect effect = new EffectProjectile(projectilePrototype, false); Effect effectAbility = new EffectProjectile(abilityProjectilePrototype, false); // Make a TowerPrototype Lightning[z] = new TowerPrototype("Lightning Tower " + level, LevelScale(level, BasePrice), SpriteTurretLightning); // Attach an AttackManagerPrototype to throw that effect, also display the damage. Lightning[z]._attackManagerPrototype = new AttackManagerPrototype(3.0f, 1f, LevelScale(level, BaseDamage), effect); // Attack a SpellManager. Lightning[z]._abilityManagerPrototype = new AbilityManagerPrototype( 0.1f, LevelScale(level, BasePowerCost), AbilityManagerPrototype.TRIGGER.ON_ATTACK_OVERRIDE, effectAbility, "Lightning", LevelScale(level, BaseAbilityDamage) + " damage." ); // Attach a PowerManagerPrototype as well, to supply power. Lightning [z]._powerManagerPrototype = new PowerManagerPrototype(LevelScale(level, BasePower), (int)LevelScale(level, BasePowerRate)); } for (int z = 0; z < 5; z++) { Lightning [z].SetUpgradesTo(Lightning [z + 1]); } } { // Generator int BasePrice = 5; int BasePowerGeneration = 5; int BasePowerRate = 10; int BasePowerCap = 250; for (int z = 0; z < 6; z++) { int level = z + 1; Generator [z] = new TowerPrototype("Generator " + level, (int)LevelScale(level, BasePrice), SpriteGenerator); // Attach a PowerManagerPrototype as well, to supply power. Generator [z]._powerManagerPrototype = new PowerManagerPrototype((int)LevelScale(level, BasePowerCap), (int)LevelScale(level, BasePowerRate)); Generator[z]._powerManagerPrototype.SetPassiveProduction(LevelScale(level, BasePowerGeneration)); Generator[z]._powerManagerPrototype.SetCanSend(true); } for (int z = 0; z < 5; z++) { Generator [z].SetUpgradesTo(Generator [z + 1]); } } { // Transfer Tower int BasePrice = 3; int BasePowerRate = 30; int BasePowerCap = 300; for (int z = 0; z < 6; z++) { int level = z + 1; Transfer [z] = new TowerPrototype("Transfer Tower " + level, (int)LevelScale(level, BasePrice), SpriteTransfer); // Attach a PowerManagerPrototype as well, to supply power. Transfer [z]._powerManagerPrototype = new PowerManagerPrototype(((int)Mathf.Pow(3, level - 1) * BasePowerCap), ((int)Mathf.Pow(3, level - 1) * BasePowerRate)); Transfer[z]._powerManagerPrototype.SetCanSend(true); Transfer[z]._powerManagerPrototype.SetCanSendLong(true); } for (int z = 0; z < 5; z++) { Transfer [z].SetUpgradesTo(Transfer [z + 1]); } } }
/* * public method Draw takes nothing returns nothing * assert(this != 0) * * integer e; e = .GetEnergy() * integer de; de = e - .lastEnergy * if .totalSent > 0 and de >= 0 and e > .maxEnergy - .data.transferPower and .numSlowedByTransferRate >= .numTransfersOut/2 then * .bottleNeckedCount = between(0, .bottleNeckedCount + 3, 15) * if .bottleNeckedCount >= 15 then * showUnitText(.u, "|cFFFF0000Bottlenecked|r") * endif * else * .bottleNeckedCount -= 1 * endif * .lastEnergy = e * .totalReceived = 0 * .totalSent = 0 * .numSlowedByTransferRate = 0 * * //show floating text * if de > 0 then * showUnitText(.u, "|cFF0000FF+" + I2S(de) + "|r") * elseif de < 0 then * showUnitText(.u, "|cFFFF00FF" + I2S(de) + "|r") * elseif .lastEnergy == 0 and .numTransfersIn == 0 and .data.usageEstimate > 0 then * showUnitText(.u, "|cFFFF0000No Power|r") * elseif .numTransfersOut == 0 and .lastEnergy >= .maxEnergy and .data.production > 0 then * showUnitText(.u, "|cFFFF0000No Target|r") * endif * * //darken/brighting the tower based on energy level * if .maxEnergy > 0 then * real r; r = I2R(.lastEnergy) / .maxEnergy * 0.75 + 0.25 * SetUnitVertexColor(.u, R2I(r*.data.tintRed), R2I(r*.data.tintGreen), R2I(r*.data.tintBlue), 255) * endif * endmethod * */ /* * ///Transfer energy to other towers for this tick * ///NOTE: Towers with lots of needed energy are placed towards the end of the * ///destination list because any energy surplus due to capacitiy early in the list * ///rolls-over to the later towers in the list. * private method PushEnergy takes nothing returns nothing * assert(this != 0) * * .PerformSortingPass() * * //transfer energy out * //note: lastEnergy >= current energy because this tower hasn't transfered out yet this tick * integer e; e = IMinBJ(.data.transferPower, .lastEnergy) * integer n; n = .numTransfersOut * integer i * loopForIntBelow(i, .numTransfersOut) * TowerTransfer tt; tt = .transfersOut[i] * Tower dst; dst = tt.dst * * //compute amount to send * integer de; de = e/n * integer te1; te1 = dst.data.transferPower - dst.totalReceived //transfer capacity of receiver * integer te2; te2 = dst.maxEnergy - IMaxBJ(dst.GetEnergy(), dst.lastEnergy) //energy capacity of receiver * if te1 < de or te2 < de then * if te1 < te2 then * de = te1 * .numSlowedByTransferRate += 1 * else * de = te2 * endif * endif * * //transfer * dst.totalReceived += de * .totalSent += de * dst.AdjustEnergy(de) * .AdjustEnergy(-de) * tt.Redraw(de) * e -= de * * n -= 1 * endloop * endmethod */ public void ApplyPrototype(PowerManagerPrototype iPrototype) { _prototype = iPrototype; }
public void SetPowerManager(PowerManagerPrototype iPowerPrototype) { _powerManagerPrototype = iPowerPrototype; }