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)
        {
            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)
 {
     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;
     }
 }
        protected override void CreateCharacter(string[] inputParams)
        {
            // create characterClass id x y team
            string type = inputParams[1];
            string id = inputParams[2];
            int x = int.Parse(inputParams[3]);
            int y = int.Parse(inputParams[4]);
            string teamTmp = inputParams[5];

            Team team;
            if(teamTmp.ToLower() == "red")
                team = Team.Red;
            else if(teamTmp.ToLower() == "blue")
                team = Team.Blue;
            else throw new ArgumentOutOfRangeException("No such team, please choose either red or blue.");

            switch (type.ToLower())
            {
                case "warrior":
                    Character warrior = new Warrior(id, x, y, team);
                    characterList.Add(warrior);
                    break;
                case "mage":
                    Character mage = new Mage(id, x, y, team);
                    characterList.Add(mage);
                    break;
                case "healer":
                    Character healer = new Healer(id, x, y, team);
                    characterList.Add(healer);
                    break;
                default:
                    break;
            }
        }
Exemple #5
0
 protected override void CreateCharacter(string[] inputParams)
 {
     switch (inputParams[1])
     {
         case "warrior":
             var warrior = new Warrior(
                 inputParams[2],
                 int.Parse(inputParams[3]),
                 int.Parse(inputParams[4]),
                 200,
                 150,
                 100,
                 (Team)Enum.Parse(typeof(Team), inputParams[5], true),
                 2
                 );
             this.characterList.Add(warrior);
             break;
         case "mage":
             var mage = new Mage(
                 inputParams[2],
                 int.Parse(inputParams[3]),
                 int.Parse(inputParams[4]),
                 150,
                 300,
                 50,
                 (Team)Enum.Parse(typeof(Team), inputParams[5], true),
                 5
                 );
             this.characterList.Add(mage);
             break;
         case "healer":
             var healer = 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(healer);
             break;
         default:
             break;
     }
 }
Exemple #6
0
        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);
        }
Exemple #7
0
        protected override void CreateCharacter(string[] inputParams)
        {
            Character character = null;
            int coordinateX = int.Parse(inputParams[3]);
            int coordinateY = int.Parse(inputParams[4]);
            var team = (Team)Enum.Parse(typeof(Team), inputParams[5]);
            switch (inputParams[1])
            {
                case "warrior":
                    character = new Warrior(inputParams[2], coordinateX, coordinateY, team);
                    break;
                case "mage":
                    character = new Mage(inputParams[2], coordinateX, coordinateY, team);
                    break;
                case "healer":
                    character = new Healer(inputParams[2], coordinateX, coordinateY, team);
                    break;
                default:
                    break;
            }

            characterList.Add(character);
        }
Exemple #8
0
        protected override void CreateCharacter(string[] inputParams)
        {
            switch (inputParams[1].ToLower())
            {
                case "warrior":
                    {
                        Team currenTeam = Team.Blue;

                        if (inputParams[5].ToLower() == "red")
                        {
                            currenTeam = Team.Red;
                        }

                        Warrior newWarrior = new Warrior(inputParams[2],
                                int.Parse(inputParams[3]), int.Parse(inputParams[4]),
                                200, 100, currenTeam, 2, 150);

                        characterList.Add(newWarrior);
                    }
                    break;

                case "mage":
                    {
                        Team currenTeam = Team.Blue;

                        if (inputParams[5].ToLower() == "red")
                        {
                            currenTeam = Team.Red;
                        }

                        Mage newMage = new Mage(inputParams[2],
                                int.Parse(inputParams[3]), int.Parse(inputParams[4]),
                                150, 50, currenTeam, 5, 300);

                        characterList.Add(newMage);
                    }
                    break;

                case "healer":
                    {
                        Team currenTeam = Team.Blue;

                        if (inputParams[5].ToLower() == "red")
                        {
                            currenTeam = Team.Red;
                        }

                        Healer newHealer = new Healer(inputParams[2],
                                int.Parse(inputParams[3]), int.Parse(inputParams[4]),
                                75, 50, currenTeam, 6, 60);

                        characterList.Add(newHealer);
                    }
                    break;
            }
        }
Exemple #9
0
        protected virtual 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]),200,100,150,(Team)Enum.Parse(typeof(Team), inputParams[5], true),2);
                    this.characterList.Add(newCharacter);
                    break;

                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 "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;
            }
        }