Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
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;
            }
        }
Пример #4
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;
     }
 }
Пример #5
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;
            }
        }