Пример #1
0
        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);
        }
Пример #2
0
        protected override void CreateCharacter(string[] inputParams)
        {
            Character character = null;
            Team      team      = 0;

            if (inputParams[5] == "Red")
            {
                team = Team.Red;
            }

            if (inputParams[5] == "Blue")
            {
                team = Team.Blue;
            }

            switch (inputParams[1])
            {
            case "warrior":
                character = new Warrior(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), 100, 50, team, 5, 80);
                break;

            case "mage":
                character = new Mage(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), 100, 80, team, 20, 90);
                break;

            case "healer":
                character = new Healer(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), 100, 10, team, 5, 50);
                break;

            default:
                break;
            }

            this.characterList.Add(character);
        }
Пример #3
0
        protected override void CreateCharacter(string[] inputParams)
        {
            string typeOfCharacter = inputParams[1];
            string characterId     = 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 "healer":
                character = new Mage(characterId, X, Y, team);
                break;

            case "mage":
                character = new Mage(characterId, X, Y, team);
                break;

            case "warrior":
                character = new Warrior(characterId, X, Y, team);
                break;

            default:
                throw new ArgumentException("Such character doesn't exist");
            }
            characterList.Add(character);
        }
Пример #4
0
        protected override void CreateCharacter(string[] inputParams)
        {
            Character character;
            Team      team = inputParams[5] == "Red"? Team.Red : Team.Blue;

            switch (inputParams[1])
            {
            case "mage": character = new Mage(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), team);
                break;

            case "warrior": character = new Warrior(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), team);
                break;

            case "healer": character = new Healer(inputParams[2], int.Parse(inputParams[3]), int.Parse(inputParams[4]), team);
                break;

            default: throw new Exception("Sorry, something went wrong :(.");
            }

            this.characterList.Add(character);
        }