コード例 #1
0
        public static Building Factory(Util.Buildings type, ManagerMouse managerMouse, ManagerMap managerMap, ManagerUnits managerUnits)
        {
            Building building = null;

            if (type == Util.Buildings.TOWN_HALL)
            {
                building = new Humans.TownHall(0, 0, managerMouse, managerMap, managerUnits);
            }
            else if (type == Util.Buildings.BARRACKS)
            {
                building = new Humans.Barracks(0, 0, managerMouse, managerMap, managerUnits);
            }
            else if (type == Util.Buildings.CHICKEN_FARM)
            {
                building = new Humans.ChickenFarm(0, 0, managerMouse, managerMap, managerUnits);
            }

            return(building);
        }
コード例 #2
0
ファイル: Building.cs プロジェクト: yufeixuan/warcraft
        public static Building Factory(Util.Buildings type, ManagerMouse managerMouse, ManagerMap managerMap, ManagerUnits managerUnits)
        {
            Building building = null;

            switch (type)
            {
            case Util.Buildings.TOWN_HALL:
                building = new Humans.TownHall(0, 0, managerMouse, managerMap, managerUnits);
                break;

            case Util.Buildings.BARRACKS:
                building = new Humans.Barracks(0, 0, managerMouse, managerMap, managerUnits);
                break;

            case Util.Buildings.CHICKEN_FARM:
                building = new Humans.ChickenFarm(0, 0, managerMouse, managerMap, managerUnits);
                break;

            case Util.Buildings.CHURCH:
                building = new Humans.Church(0, 0, managerMouse, managerMap, managerUnits);
                break;

            case Util.Buildings.GREAT_HALL:
                building = new Orcs.GreatHall(0, 0, managerMouse, managerMap, managerUnits);
                break;

            case Util.Buildings.ORC_BARRACKS:
                building = new Orcs.Barracks(0, 0, managerMouse, managerMap, managerUnits);
                break;

            case Util.Buildings.PIG_FARM:
                building = new Orcs.PigFarm(0, 0, managerMouse, managerMap, managerUnits);
                break;

            case Util.Buildings.ALTAR_OF_STORMS:
                building = new Orcs.AltarOfStorms(0, 0, managerMouse, managerMap, managerUnits);
                break;
            }

            return(building);
        }