示例#1
0
        public SourceBuildingModel(Player playerOwner, int townID, int hexaID)
            : base(playerOwner)
        {
            this.townID = townID;
            this.hexaID = hexaID;
            upgrade = UpgradeKind.NoUpgrade;

            TownModel town = GameState.map.GetTownByID(townID);
            int buildingPos = town.FindBuildingByHexaID(hexaID);
            HexaModel hexa = town.GetHexa(buildingPos);

            SourceAll sourceNormal = new SourceAll(0);
            int amountNormal = hexa.GetStartSource();
            switch (hexa.GetKind())
            {
                case HexaKind.Forest:
                    sourceNormal = new SourceAll(0, 0, 0, amountNormal, 0);
                    break;

                case HexaKind.Stone:
                    sourceNormal = new SourceAll(0, 0, amountNormal, 0, 0);
                    break;

                case HexaKind.Cornfield:
                    sourceNormal = new SourceAll(amountNormal, 0, 0, 0, 0);
                    break;

                case HexaKind.Pasture:
                    sourceNormal = new SourceAll(0, amountNormal, 0, 0, 0);
                    break;

                case HexaKind.Mountains:
                    sourceNormal = new SourceAll(0, 0, 0, 0, amountNormal);
                    break;
            }
            playerOwner.AddCollectSources(sourceNormal, new SourceAll(0));

            upgrade1cost = new SourceAll(0);
            upgrade2cost = new SourceAll(0);
            switch (hexa.GetKind())
            {
                case HexaKind.Mountains:
                    buildingKind = SourceBuildingKind.Mine;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_MINE;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_MINE;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_MINE;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_MINE;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_MINE;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconMineActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMine);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMine1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMine2);
                    break;
                case HexaKind.Forest:
                    buildingKind = SourceBuildingKind.Saw;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_SAW;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_SAW;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_SAW;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_SAW;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_SAW;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconSawActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconSaw);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconSaw1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconSaw2);
                    break;
                case HexaKind.Cornfield:
                    buildingKind = SourceBuildingKind.Mill;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_MILL;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_MILL;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_MILL;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_MILL;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_MILL;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconMillActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMill);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMill1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMill2);
                    break;
                case HexaKind.Pasture:
                    buildingKind = SourceBuildingKind.Stepherd;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_STEPHERD;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_STEPHERD;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_STEPHERD;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_STEPHERD;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_STEPHERD;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherdActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherd);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherd1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherd2);
                    break;
                case HexaKind.Stone:
                    buildingKind = SourceBuildingKind.Quarry;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_QUARRY;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_QUARRY;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_QUARRY;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_QUARRY;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_QUARRY;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarryActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarry);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarry1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarry2);
                    break;
            }
        }