protected override void ExecuteAddSupplementCommand(string[] commandWords) { switch (commandWords[1]) { case "PowerCatalyst": var powerCatalyst = new PowerCatalyst(); Unit targetUnit = this.GetUnit(commandWords[2]); targetUnit.AddSupplement(powerCatalyst); break; case "HealthCatalyst": var healthCatalyst = new HealthCatalyst(); targetUnit = this.GetUnit(commandWords[2]); targetUnit.AddSupplement(healthCatalyst); break; case "AggressionInhibitor": var aggressionCatalyst = new AggressionCatalyst(); targetUnit = this.GetUnit(commandWords[2]); targetUnit.AddSupplement(aggressionCatalyst); break; case "Weapon": var weapon = new Weapon(); targetUnit = this.GetUnit(commandWords[2]); targetUnit.AddSupplement(weapon); break; default: break; } }
protected override void ExecuteAddSupplementCommand(string[] commandWords) { var unit = this.GetUnit(commandWords[2]); ISupplement supplement; switch (commandWords[1]) { case "Weapon": supplement = new Weapon(); break; case "PowerCatalyst": supplement = new PowerCatalyst(); break; case "HealthCatalyst": supplement = new HealthCatalyst(); break; case "AggressionCatalyst": supplement = new AggressionCatalyst(); break; default: throw new ArgumentException("Unsupported command", commandWords[1]); } unit.AddSupplement(supplement); }
protected override void ExecuteAddSupplementCommand(string[] commandWords) { var supplementType = commandWords[1]; ISupplement supplement = null; switch (supplementType) { case "AggressionCatalyst": supplement = new AggressionCatalyst(); break; case "PowerCatalyst": supplement = new PowerCatalyst(); break; case "HealthCatalyst": supplement = new HealthCatalyst(); break; case "Weapon": supplement = new Weapon(); break; default: break; } var unitId = commandWords[2]; var unit = this.GetUnit(unitId); if (unit != null) { unit.AddSupplement(supplement); } }
protected override void ExecuteAddSupplementCommand(string[] commandWords) { switch (commandWords[1]) { case "AggressionCatalyst": var aggCatalyst = new AggressionCatalyst(); this.GetUnit(commandWords[2]).AddSupplement(aggCatalyst); break; case "PowerCatalyst": var powerCatalyst = new PowerCatalyst(); this.GetUnit(commandWords[2]).AddSupplement(powerCatalyst); break; case "HealthCatalyst": var healthCatalyst = new HealthCatalyst(); this.GetUnit(commandWords[2]).AddSupplement(healthCatalyst); break; case "Weapon": var weapon = new Weapon(); this.GetUnit(commandWords[2]).AddSupplement(weapon); break; //case "InfestationSpores": // var infSpores = new InfestationSpores(); // this.GetUnit(commandWords[2]).AddSupplement(infSpores); // break; default: break; } }
private void AddWeaponSupplement(Unit unit) { Weapon weapon = null; if (unit is Marine) { weapon = new Weapon(Weapon.WeaponHealth, Weapon.WeaponPower, Weapon.WeaponAggression); } else { weapon = new Weapon(); } unit.AddSupplement(weapon); }
protected override void ExecuteAddSupplementCommand(string[] commandWords) { switch (commandWords[1]) { case "PowerCatalyst": { var inhibitor = new PowerCatalyst(); var target = this.GetUnit(commandWords[2]); target.AddSupplement(inhibitor); } break; case "HealthCatalyst": { var inhibitor = new HealthCatalyst(); var target = this.GetUnit(commandWords[2]); target.AddSupplement(inhibitor); } break; case "AggressionCatalyst ": { var inhibitor = new AggresionCatalyst(); var target = this.GetUnit(commandWords[2]); target.AddSupplement(inhibitor); } break; case "Weapon": { var weapon = new Weapon(); var target = this.GetUnit(commandWords[2]); target.AddSupplement(weapon); } break; default: base.ExecuteAddSupplementCommand(commandWords); break; } }
protected override void ExecuteAddSupplementCommand(string[] commandWords) { switch (commandWords[1]) { case "PowerInhibitor": { var powerInhibitor = new PowerInhibitor(); var targetUnit = base.GetUnit(commandWords[2]); targetUnit.AddSupplement(powerInhibitor); break; } case "HealthInhibitor": { var healthInhibitor = new HealthInhibitor(); var targetUnit = base.GetUnit(commandWords[2]); targetUnit.AddSupplement(healthInhibitor); break; } case "AggressionInhibitor": { var aggressionInhibitor = new AggressionInhibitor(); var targetUnit = base.GetUnit(commandWords[2]); targetUnit.AddSupplement(aggressionInhibitor); break; } case "Weapon": { var weapon = new Weapon(); var targetUnit = base.GetUnit(commandWords[2]); targetUnit.AddSupplement(weapon); break; } default: break; } }