예제 #1
0
        protected override void ExecuteInsertUnitCommand(string[] commandWords)
        {
            switch (commandWords[1])
            {
                case MarineInsertCase:
                    {
                        var marine = new Marine(commandWords[2]);
                        this.InsertUnit(marine);
                        break;
                    }
                case TankInsertCase:
                    {
                        var tank = new Tank(commandWords[2]);
                        this.InsertUnit(tank);
                        break;

                    }
                case QueenInsertCase:
                    {
                        var queen = new Queen(commandWords[2]);
                        this.InsertUnit(queen);
                        break;
                    }
                case ParasiteInsertCase:
                    {
                        var parasite = new Parasite(commandWords[2]);
                        this.InsertUnit(parasite);
                        break;
                    }
                default:
                    base.ExecuteInsertUnitCommand(commandWords);
                    break;
            }
        }
 protected override void ExecuteInsertUnitCommand(string[] commandWords)
 {
     switch (commandWords[1])
     {
         case "Marine":
             var marine = new Marine(commandWords[2]);
             this.InsertUnit(marine);
             break;
         case "Tank":
             var tank = new Tank(commandWords[2]);
             this.InsertUnit(tank);
             break;
         case "Parasite":
             var parasite = new Parasite(commandWords[2]);
             this.InsertUnit(parasite);
             break;
         case "Queen":
             var queen = new Queen(commandWords[2]);
             this.InsertUnit(queen);
             break;
         default:
             base.ExecuteInsertUnitCommand(commandWords);
             break;
     }
 }
        protected override void ExecuteInsertUnitCommand(string[] commandWords)
        {
            var unitType = commandWords[1];
            var unitId = commandWords[2];

            Unit unitToBeAdded = null;

            switch (unitType)
            {
                case "Marine":
                    unitToBeAdded = new Marine(unitId);
                    break;
                case "Parasite":
                    unitToBeAdded = new Parasite(unitId);
                    break;
                case "Queen":
                    unitToBeAdded = new Queen(unitId);
                    break;
                case "Tank":
                    unitToBeAdded = new Tank(unitId);
                    break;
                default:
                    base.ExecuteInsertUnitCommand(commandWords);
                    break;
            }

            if (unitToBeAdded != null)
            {
                this.InsertUnit(unitToBeAdded);
            }
        }
 protected override void ExecuteInsertUnitCommand(string[] commandWords)
 {
     switch (commandWords[1])
     {
         case "Tank":
             var tank = new Tank(commandWords[2]);
             base.InsertUnit(tank);
             break;
         case "Marine":
             var marine = new Marine(commandWords[2]);
             base.InsertUnit(marine);
             break;
         default:
             base.ExecuteInsertUnitCommand(commandWords);
             break;
     }
 }