public Unit CreateUnitWithJob(Team team, int job) { Unit unit = null; switch (job) { case 0: unit = new Mercenary(team); break; case 1: unit = new Soldier(team); break; case 2: unit = new Fighter(team); break; case 3: unit = new Healer(team); break; case 4: unit = new Mage(team); break; } return(unit); }
public Unit CreateUnitWithJob(Team team, int job, byte MaxHealth, byte CurrentHealth, byte Attack, byte Speed, byte Defense, byte Resistance, bool CanMove) { Unit unit = null; switch (job) { case 0: unit = new Mercenary(team, MaxHealth, CurrentHealth, Attack, Speed, Defense, Resistance, CanMove); break; case 1: unit = new Soldier(team, MaxHealth, CurrentHealth, Attack, Speed, Defense, Resistance, CanMove); break; case 2: unit = new Fighter(team, MaxHealth, CurrentHealth, Attack, Speed, Defense, Resistance, CanMove); break; case 3: unit = new Healer(team, MaxHealth, CurrentHealth, Attack, Speed, Defense, Resistance, CanMove); break; case 4: unit = new Mage(team, MaxHealth, CurrentHealth, Attack, Speed, Defense, Resistance, CanMove); break; } return(unit); }
protected override void CreateCharacter(string[] inputParams) { string type = inputParams[1]; string name = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); string team = inputParams[5]; switch (type) { case "mage": Mage mage = new Mage(name, x, y, team == "Blue" ? Team.Blue : Team.Red); characterList.Add(mage); break; case "warrior": Warrior warrior = new Warrior(name, x, y, team == "Blue" ? Team.Blue : Team.Red); characterList.Add(warrior); break; case "healer": Healer healer = new Healer(name, x, y, team == "Blue" ? Team.Blue : Team.Red); characterList.Add(healer); break; } }
// Implemented protected virtual void CreateCharacter(string[] inputParams) { string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team; if (inputParams[5] == "Blue") { team = Team.Blue; } else { team = Team.Red; } if (inputParams[1] == "warrior") { Character warrior = new Warrior(id, x, y, 0, 0, team, 0); characterList.Add(warrior); } else if (inputParams[1] == "mage") { Character mage = new Mage(id, x, y, 0, 0, team, 0); characterList.Add(mage); } else { Character healer = new Healer(id, x, y, 0, 0, team, 0); characterList.Add(healer); } }
protected override void CreateCharacter(string[] inputParams) { Character character = null; string typeOfCharacter = inputParams[1]; string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team = (Team)Enum.Parse(typeof(Team), inputParams[5], true); switch (typeOfCharacter) { case "warrior": character = new Warrior(id, x, y, team); break; case "mage": character = new Mage(id, x, y, team); break; case "healer": character = new Healer(id, x, y, team); break; default: throw new ArgumentException("Invalid type of character"); } characterList.Add(character); }
protected override void CreateCharacter(string[] inputParams) { var type = inputParams[1]; var name = inputParams[2]; var x = int.Parse(inputParams[3]); var y = int.Parse(inputParams[4]); var team = inputParams[5]; switch (type) { case "mage": var mage = new Mage(name, x, y, team == "Blue" ? Team.Blue : Team.Red); this.characterList.Add(mage); break; case "warrior": var warrior = new Warrior(name, x, y, team == "Blue" ? Team.Blue : Team.Red); this.characterList.Add(warrior); break; case "healer": var healer = new Healer(name, x, y, team == "Blue" ? Team.Blue : Team.Red); this.characterList.Add(healer); break; } }
protected override void CreateCharacter(string[] inputParams) { var characterType = inputParams[1]; var characterId = inputParams[2]; var characterX = int.Parse(inputParams[3]); var characterY = int.Parse(inputParams[4]); var characterTeam = (Team)Enum.Parse(typeof(Team), inputParams[5]); ExtendedCharacter character = null; switch (characterType) { case "warrior": character = new Warrior(characterId, characterX, characterY, characterTeam); break; case "mage": character = new Mage(characterId, characterX, characterY, characterTeam); break; case "healer": character = new Healer(characterId, characterX, characterY, characterTeam); break; } this.characterList.Add(character); }
private (float, Healer) GetHealthModifier(Team agentTeam) { Healer healers = 0; float modifier = 1f; float percentMedBoost = settings.MedicineBoost / 100f; if (agentTeam != null && agentTeam.GeneralAgent != null) { modifier += agentTeam.GeneralAgent.Character.GetSkillValue(DefaultSkills.Medicine) / 50f * settings.CommanderMedicineBoost / 100f; healers |= Healer.General; } if (Agent.Monster.FamilyType == HumanFamilyType) // Since only humans have skills... { modifier += Agent.Character.GetSkillValue(DefaultSkills.Medicine) / 50f * percentMedBoost; healers |= Healer.Self; } else if (Agent.IsMount && Agent.MountAgent != null) { modifier += Agent.MountAgent.Character.GetSkillValue(DefaultSkills.Medicine) / 50f * percentMedBoost; healers |= Healer.Rider; } if (settings.Debug) { behavior.messages.Enqueue(string.Format("[BattleRegeneration] {0} agent {1} is receiving a {2} multiplier in health regeneration", GetTroopType(agentTeam), Agent.Name, modifier)); } return(modifier, healers); }
protected override void CreateCharacter(string[] inputParams) { int x; int y; Team team; Character character; switch (inputParams[1].ToLower()) { case "mage": x = int.Parse(inputParams[3]); y = int.Parse(inputParams[4]); team = (Team)Enum.Parse(typeof(Team), inputParams[5], true); character = new Mage(inputParams[2], x, y, team); this.characterList.Add(character); break; case "warrior": x = int.Parse(inputParams[3]); y = int.Parse(inputParams[4]); team = (Team)Enum.Parse(typeof(Team), inputParams[5], true); character = new Warrior(inputParams[2], x, y, team); this.characterList.Add(character); break; case "healer": x = int.Parse(inputParams[3]); y = int.Parse(inputParams[4]); team = (Team)Enum.Parse(typeof(Team), inputParams[5], true); character = new Healer(inputParams[2], x, y, team); this.characterList.Add(character); break; } }
protected virtual void CreateCharacter(string[] inputParams) { var characterClass = inputParams[1].ToLower(); var id = inputParams[2]; var x = int.Parse(inputParams[3]); var y = int.Parse(inputParams[4]); var team = (Team)Enum.Parse(typeof(Team), inputParams[5], true); Character character; switch (characterClass) { case "warrior": character = new Warrior(id, x, y, team); this.characterList.Add(character); break; case "mage": character = new Mage(id, x, y, team); this.characterList.Add(character); break; case "healer": character = new Healer(id, x, y, team); this.characterList.Add(character); break; } }
public async Task <ActionResult <Healer> > PostHealer(Healer healer) { _context.Healers.Add(healer); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHealer", new { id = healer.Id }, healer)); }
public async Task <IActionResult> PutHealer(int id, Healer healer) { if (id != healer.Id) { return(BadRequest()); } _context.Entry(healer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HealerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
static void Main(string[] args) { Appearance forArch = new Appearance(64, "Ирокез", "Ельф"); Appearance forHealer = new Appearance(32, "Рыжий", "Человек"); Appearance forUnit = new Appearance(60, "Темные короткие", "Люди"); Archer ar = new Archer(Bow.Bone3000); Archer ar1 = new Archer(ar, Bow.Bone3000); Cavalier cv = new Cavalier(Sword.StickFromTheYard); Unit un = new Unit(150, 200, 300, 400, "Пивовар", forUnit); Healer hl = new Healer(HealingDevice.MumScream); un.ShowInfo(); ar.ShowInfo(); ar1.ShowInfo(); ar1.Attack(ar); ar1.ShowInfo(); ar.ShowInfo(); hl.HealUnit(ar); ar.ShowInfo(); cv.Attack(ar); cv.ShowInfo(); ar.ShowInfo(); cv.ShowAppearance(); un.ShowAppearance(); }
protected virtual void CreateCharacter(string[] inputParams) { string type = inputParams[1]; string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team = (Team)Enum.Parse(typeof(Team), inputParams[5]); switch (type) { case "warrior": Warrior warrior = new Warrior(id, x, y, team); this.characterList.Add(warrior); break; case "mage": Mage mage = new Mage(id, x, y, team); this.characterList.Add(mage); break; case "healer": Healer healer = new Healer(id, x, y, team); this.characterList.Add(healer); break; default: throw new NotSupportedException("Character type not supported."); } }
private Warrior CreateWarrior(string selector, string name, int health, int attack, int defense, int ultimate, Item item) { Warrior w; Dice dice = new Dice(); switch (selector) { case "System.Windows.Controls.ComboBoxItem: Warrior": w = new Warrior(name, health + item.HealthBonus, attack + item.AttackBonus, defense + item.DefenseBonus, dice); break; case "System.Windows.Controls.ComboBoxItem: Wizard": w = new Wizard(name, health + item.HealthBonus, attack + item.AttackBonus, defense + item.DefenseBonus, dice, 40, ultimate + item.UltimateBonus); break; case "System.Windows.Controls.ComboBoxItem: Healer": w = new Healer(name, health + item.HealthBonus, attack + item.AttackBonus, defense + item.DefenseBonus, dice, 40, ultimate + item.UltimateBonus); break; default: w = new Warrior(name, health + item.HealthBonus, attack + item.AttackBonus, defense + item.DefenseBonus, dice); break; } return(w); }
static void Main(string[] args) { var popoi = new Grimoire(new Mage("Popoi", 50, 80, 10, 5, 5, 30, 50)); var link = new Warrior("Link", 50, 80, 10, 5, 5, 30, 50); var psyduck = new Healer("Psyduck", 50, 80, 10, 5, 5, 30); psyduck.MagicCasting += popoi.Healer_MagicCasting; psyduck.MagicCasting += link.Healer_MagicCasting; psyduck.MagicCasting += psyduck.Healer_MagicCasting; var chopper = new Sword(new Warrior("Chopper", 50, 80, 10, 5, 5, 30, 50)); var johnDoe = new Paladin("johnDoe", 50, 20, 60, 12, 50, 2); var mike = new Paladin("mike", 50, 20, 60, 12, 50, 2); var game = new Game( new List <Character> { popoi, link, johnDoe }, new List <Character> { psyduck, chopper, mike }); while (!game.HasEnded()) { game.PlayTurn(); } game.DisplayScore(); Console.ReadKey(); }
protected override void CreateCharacter(string[] inputParams) { Character newCharacter; switch (inputParams[1].ToLower()) { case "warrior": newCharacter = new Warrior(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), (Team)Enum.Parse(typeof(Team), inputParams[5], true)); this.characterList.Add(newCharacter); break; case "mage": newCharacter = new Mage(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), (Team)Enum.Parse(typeof(Team), inputParams[5], true)); this.characterList.Add(newCharacter); break; case "healer": newCharacter = new Healer(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), (Team)Enum.Parse(typeof(Team), inputParams[5], true)); this.characterList.Add(newCharacter); break; default: break; } }
protected override void CreateCharacter(string[] inputParams) { Character character; string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team = (Team)Enum.Parse(typeof(Team), inputParams[5]); string type = inputParams[1]; switch (type) { case "mage": character = new Mage(id, x, y, team); break; case "warrior": character = new Warrior(id, x, y, team); break; case "healer": default: character = new Healer(id, x, y, team); break; } characterList.Add(character); }
protected override void CreateCharacter(string[] inputParams) { string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team; Enum.TryParse(inputParams[5], out team); switch (inputParams[1]) { case "warrior": Warrior warrior = new Warrior(id, x, y, team); this.characterList.Add(warrior); break; case "mage": Mage mage = new Mage(id, x, y, team); this.characterList.Add(mage); break; case "healer": Healer healer = new Healer(id, x, y, team); this.characterList.Add(healer); break; } }
private void EndHeal() { if (Context.ContainsKey(Healer)) Context.Remove(Healer); if (Patient != Healer && Patient.InRange(Healer.Location, 2)) { Healer.PlaySound(0x57); if (EnchantedApple.GetTotalCurses(Patient) == 0) Healer.SendLocalizedMessage(500968); // You apply the bandages, but they barely help. else Healer.SendLocalizedMessage(500969); // You finish applying the bandages. EvilOmenSpell.TryEndEffect(Patient); StrangleSpell.RemoveCurse(Patient); CorpseSkinSpell.RemoveCurse(Patient); WeakenSpell.RemoveEffects(Patient); FeeblemindSpell.RemoveEffects(Patient); ClumsySpell.RemoveEffects(Patient); CurseSpell.RemoveEffect(Patient); MortalStrike.EndWound(Patient); BloodOathSpell.RemoveCurse(Patient); MindRotSpell.ClearMindRotScalar(Patient); SpellPlagueSpell.RemoveFromList(Patient); SleepSpell.EndSleep(Patient); BuffInfo.RemoveBuff(Patient, BuffIcon.MassCurse); } else { Healer.SendLocalizedMessage(500295); // You are too far away to do that. } }
protected override void CreateCharacter(string[] inputParams) { Character character; string characterType = inputParams[1]; string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team = (Team)Enum.Parse(typeof(Team), inputParams[5]); switch (characterType) { case "mage": character = new Mage(id, x, y, team); break; case "warrior": character = new Warrior(id, x, y, team); break; case "healer": default: character = new Healer(id, x, y, team); break; } characterList.Add(character); }
private void HealersToggleButton_OnChecked(object sender, RoutedEventArgs e) { if (HealControls.Count == 0) { HealsEnableCheckBox.IsChecked = false; return; } if (HealControls.Any(healControl => !healControl.AreControlsFilledIn())) { HealsEnableCheckBox.IsChecked = false; return; } foreach (var healControl in HealControls) { healControl.DisableControls(); healControl.EnableHeals(); } _healer = new Healer(); _healer.Process = ((TibiaProc)processCombo.SelectedItem).Process; _healer.HealControls = HealControls; _healer.HealPrio(); }
protected override void CreateCharacter(string[] inputParams) { Character character = null; string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team = (Team)Enum.Parse(typeof(Team), inputParams[5]); switch (inputParams[1]) { case "mage": character = new Mage(id, x, y, team); break; case "warrior": character = new Warrior(id, x, y, team); break; case "healer": character=new Healer(id,x,y,team); break; default: throw new InvalidOperationException("Character not found in the game!"); } this.characterList.Add(character); }
protected override void CreateCharacter(string[] inputParams) { string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team = (Team)Enum.Parse(typeof(Team), inputParams[5]); Character currentCharacter; switch (inputParams[1]) { case "mage": currentCharacter = new Mage(id, x, y, team); break; case "warrior": currentCharacter = new Warrior(id, x, y, team); break; case "healer": currentCharacter = new Healer(id, x, y, team); break; default: throw new InvalidOperationException(); break; } this.characterList.Add(currentCharacter); }
protected override void CreateCharacter(string[] inputParams) { string characterType = inputParams[1]; string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); string team = inputParams[5]; switch (characterType) { case "mage": var mage = new Mage(id, x, y, (Team)Enum.Parse(typeof(Team), team)); this.characterList.Add(mage); break; case "warrior": var warrior = new Warrior(id, x, y, (Team)Enum.Parse(typeof(Team), team)); this.characterList.Add(warrior); break; case "healer": var healer = new Healer(id, x, y, (Team)Enum.Parse(typeof(Team), team)); this.characterList.Add(healer); break; default: base.CreateCharacter(inputParams); break; } }
public void Show() { string classSelected = inputField.text; Class clase = null; switch (classSelected) { case "1": clase = new Wizard("Wizard"); break; case "2": clase = new Warrior("Warrior"); break; case "3": clase = new Healer("Healer"); break; } if (clase != null) { Debug.Log("You choose " + clase.Clase()); } }
protected override void CreateCharacter(string[] inputParams) { var type = inputParams[1]; var name = inputParams[2]; var x = int.Parse(inputParams[3]); var y = int.Parse(inputParams[4]); var team = (Team)Enum.Parse(typeof(Team), inputParams[5], true); Character cha; switch (type) { case "warrior": cha = new Warrior(name, x, y, team); break; case "mage": cha = new Mage(name, x, y, team); break; case "healer": cha = new Healer(name, x, y, team); break; default: return; } this.characterList.Add(cha); }
public void HealerIsAHealer() { Unit healerOne = new Healer(Team.BLUE); Job expectedResult = Job.HEALER; Job actualResult = healerOne.GetJob(); Assert.AreEqual(expectedResult, actualResult); }
public Func <Spirit, GameState, Cause, Task> Destroy1PresenceFromBlightCard = DefaultDestroy1PresenceFromBlightCard; // Direct distruction from Blight Card, not cascading void TokenCleanUp(GameState gs) { Healer.HealAll(gs); // called at end of round. foreach (var spaceTokens in Tokens.ForAllSpaces) { spaceTokens.Blight.Blocked = false; } }
void Awake() { healer = GetComponent <Healer>(); infantry = GetComponent <Infantry>(); knight = GetComponent <Knight>(); mage = GetComponent <Mage>(); spy = GetComponent <Spy>(); }
protected override void CreateCharacter(string[] inputParams) { Character character; Team team; switch (inputParams[5].ToLower()) { case "red": team = Team.Red; break; case "blue": team = Team.Blue; break; default: throw new ApplicationException("Wrong color team."); } switch (inputParams[1].ToLower()) { case "warrior": character = new Warrior( id: inputParams[2], x: int.Parse(inputParams[3]), y: int.Parse(inputParams[4]), healthPoints: 100, defensePoints: 30, team: team, range: 10, attackPoints: 60); break; case "healer": character = new Healer( id: inputParams[2], x: int.Parse(inputParams[3]), y: int.Parse(inputParams[4]), healthPoints: 100, defensePoints: 0, team: team, range: 10, healingPoints: 30); break; case "mage": character = new Mage( id: inputParams[2], x: int.Parse(inputParams[3]), y: int.Parse(inputParams[4]), healthPoints: 100, defensePoints: 5, team: team, range: 10, attackPoints: 30); break; default: throw new ApplicationException("No such kind of hero."); } this.characterList.Add(character); }
public IActionResult EditHealer(Healer healer) { if (!ModelState.IsValid) { return(EditHealer(healer.Id)); } _dataProvider.Save(healer); return(RedirectToAction("Healers")); }
public override void Fire() { Vector2 rayOrigin = transform.position; Vector2 direction = transform.right.normalized; //Declare a raycast hit to store information about what our raycast has hit. RaycastHit2D hit = Physics2D.Raycast(rayOrigin, direction, weaponRange, LayerMask.GetMask("Player")); //RaycastHit2D hit = Physics2D.Raycast(rayOrigin, direction, weaponRange); //Set the start position for our visual effect for our laser to the position of gunEnd laserLine.SetPosition(0, new Vector3(rayOrigin.x, rayOrigin.y, 10)); //Set the end position for our laser line Vector2 endPos = rayOrigin + (direction * weaponRange); laserLine.SetPosition(1, new Vector3(endPos.x, endPos.y, 10)); StartCoroutine(ShotEffect()); //Check if our raycast has hit anything if (hit.collider != null) { Healer self = transform.GetComponentInParent <Healer>(); //Get a reference to a health script attached to the collider we hit BasePlayer target = hit.collider.GetComponent <BasePlayer>(); //If there was a player script attached if (target != null && self != null) { //Call the damage function of that script, passing in our gunDamage variable target.ServerTakeDamage(gunDamage); self.ServerUseMana(abCost); } Debug.Log("Healing " + hit.collider.gameObject.name); Debug.Log("Mana: " + self.CurrentMana); self.ServerUseMana(abCost); Debug.Log("Mana: " + self.CurrentMana); //Check if the object we hit has a rigidbody attached if (hit.rigidbody != null) { //Add force to the rigidbody we hit, in the direction it was hit from hit.rigidbody.AddForce(-hit.normal * hitForce); } } else { Debug.Log("No nearby ally"); //if we did not hit anything, set the end of the line to a position directly away from //laserLine.SetPosition(1, transform.right * weaponRange); Debug.Log("No allies"); } }
// Negative feedback void Level2Combat() { BasicCombat(); // If the tank's health is below 1500, the healer should will free cast an extra heal. // The heal is either BigHeal or SmallHeal, chosen randomly. if (warrior.health <= 1500) { Healer priestHealer = priest.GetComponent <Healer>(); priestHealer.FreeCastSpell(RandomlyChooseHeal(), warrior); } }
protected override void DoAction() { Healer heal = Item.Holder.gameObject.AddComponent <Healer>(); heal.HowMuch = Power; Item.PlaySound(Sounds.Heal); if (GetAnimator()) { GetAnimator().SetTrigger("block"); } }
protected override void CreateCharacter(string[] inputParams) { Character character = null; Team team; switch (inputParams[5].ToLower()) { case "red": team = Team.Red; break; case "blue": team = Team.Blue; break; default: throw new ArgumentException("Unknown team."); } switch (inputParams[1].ToLower()) { case "warrior": character = new Warrior( id: inputParams[2], x: int.Parse(inputParams[3]), y: int.Parse(inputParams[4]), team: team); break; case "healer": character = new Healer( id: inputParams[2], x: int.Parse(inputParams[3]), y: int.Parse(inputParams[4]), team: team); break; case "mage": character = new Mage( id: inputParams[2], x: int.Parse(inputParams[3]), y: int.Parse(inputParams[4]), team: team); break; default: throw new ArgumentException("Wrong character."); } this.characterList.Add(character); }
protected override void CreateCharacter(string[] inputParams) { Character newCharacter; switch (inputParams[1].ToLower()) { case "mage": newCharacter = new Mage ( inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), 150, 50, 300, (Team)Enum.Parse(typeof(Team), inputParams[5], true), 5 ); this.characterList.Add(newCharacter); break; case "warrior": newCharacter = new Warrior( inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), 200, 100, 150, (Team)Enum.Parse(typeof(Team), inputParams[5], true), 2 ); this.characterList.Add(newCharacter); break; case "healer": newCharacter = new Healer( inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), 75, 50, 60, (Team)Enum.Parse(typeof(Team), inputParams[5], true), 6 ); this.characterList.Add(newCharacter); break; default: break; } }
protected override void CreateCharacter(string[] inputParams) { Character character = null; switch (inputParams[1].ToLower()) { case "warrior": character = new Warrior(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), 200, 100, (Team)Enum.Parse(typeof(Team), inputParams[5], true), 2, 150); break; case "mage": character = new Mage(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), 150, 50, (Team)Enum.Parse(typeof(Team), inputParams[5], true), 5, 300); break; case "healer": character = new Healer(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), 75, 50, (Team)Enum.Parse(typeof(Team), inputParams[5], true), 6, 60); break; default: throw new FormatException("This character is not exist!"); } this.characterList.Add(character); }
protected override void CreateCharacter(string[] inputParams) { string id = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team; Enum.TryParse(inputParams[5], out team); switch (inputParams[1]) { case "warrior": Warrior warrior = new Warrior(id, x,y,team); this.characterList.Add(warrior); break; case "mage": Mage mage = new Mage(id, x,y,team); this.characterList.Add(mage); break; case "healer": Healer healer = new Healer(id, x, y, team); this.characterList.Add(healer); break; } }
public void Start() { Healer hb = HeroMgr.getHeroByType(HeroData.HEALER) as Healer; healer = hb; }
protected virtual void CreateCharacter(string[] inputParams) { //try var characterClass = inputParams[1]; var characterName = inputParams[2]; var characterX = int.Parse(inputParams[3]); var characterY = int.Parse(inputParams[4]); var characterTeam = inputParams[5]; if (characterClass == "mage") { Character newCharacter = new Mage(characterName, characterX, characterY, characterTeam == "Red" ? Team.Red : Team.Blue); characterList.Add(newCharacter); Console.WriteLine("New mage {0} created", newCharacter.Id); } if (characterClass == "warrior") { Character newCharacter = new Warrior(characterName, characterX, characterY, characterTeam == "Red" ? Team.Red : Team.Blue); characterList.Add(newCharacter); Console.WriteLine("New warrior {0} created", newCharacter.Id); } if (characterClass == "healer") { Character newCharacter = new Healer(characterName, characterX, characterY, characterTeam == "Red" ? Team.Red : Team.Blue); characterList.Add(newCharacter); Console.WriteLine("New Healer {0} created", newCharacter.Id); } }
protected virtual void CreateCharacter(string[] inputParams) { string typeOfCharacter = inputParams[1]; string name = inputParams[2]; int x = int.Parse(inputParams[3]); int y = int.Parse(inputParams[4]); Team team = (Team) Enum.Parse(typeof (Team), inputParams[5]); Character character; switch (typeOfCharacter) { case "mage": character = new Mage(name, x, y, team); break; case "warrior": character = new Warrior(name, x, y, team); break; case "healer": character = new Healer(name,x,y,team); break; default: throw new GameException("Such character doesn't exist"); } characterList.Add(character); }