Beispiel #1
0
        public HexaModel(int value, HexaKind kind, SourceKind sourceKind, SourceBuildingKind buildingKind,SourceAll sourceBuildingCost)
        {
            if (kind == HexaKind.Water)
            {
                this.hexaID = -1;
            } else
                this.hexaID = ++counter;

            this.sourceBuildingCost = sourceBuildingCost;

            this.kind = kind;
            this.sourceKind = sourceKind;
            this.buildingKind = buildingKind;

            this.startSource = value;
            this.towns = new TownModel[(int) TownPos.Count];
            this.roads = new RoadModel[(int)RoadPos.Count];
            this.townOwner = new Boolean[(int)TownPos.Count];
            this.roadOwner = new Boolean[(int)RoadPos.Count];

            sourceDisaster = false;
            sourceMiracle = false;
            hexaDestroy = false;
            captureIs = false;
            capturePlayer = null;
        }
Beispiel #2
0
 public static HexaModel create(HexaKind type, int number)
 {
     switch (type)
     {
         case HexaKind.Cornfield:
             return new CornfieldHexa(number);
         case HexaKind.Desert:
             return new DesertHexa();
         case HexaKind.Forest:
             return new ForestHexa(number);
         case HexaKind.Mountains:
             return new MountainsHexa(number);
         case HexaKind.Pasture:
             return new PastureHexa(number);
         case HexaKind.Stone:
             return new StoneHexa(number);
         case HexaKind.Water:
             return new WaterHexa();
         case HexaKind.Nothing:
             return null;
         default:
             throw new Exception("XML file with map is broken.");
     }
 }
Beispiel #3
0
        public HexaView(HexaModel model, int x, int y)
        {
            this.x = x;
            this.y = y;

            this.model = model;
            this.hexaID = model.GetID();
            this.kind = model.GetKind();
            hexaRotation = GameMaster.Inst().GetRandomInt(6);

            if (kind != HexaKind.Water)
            {
                this.pickHexaColor = new Color(1.0f - this.hexaID / 256.0f, 0.0f, 0.0f);

                pickVars = new PickVariables(pickHexaColor);

                roadView = new RoadView[(int)RoadPos.Count];
                townView = new TownView[(int)TownPos.Count];
            }
        }
Beispiel #4
0
 public Model GetHexaModel(HexaKind type)
 {
     return hexaModel[(int)type];
 }
Beispiel #5
0
        bool isPositive; // false it is negative

        #endregion Fields

        #region Constructors

        private RndEvent(HexaKind hexaKind, bool isPositive)
        {
            this.isPositive = isPositive;
            this.hexaKind = hexaKind;

            string title = "";
            string description = "";
            Texture2D icon = null; ;
            if (isPositive)
            {
                switch (hexaKind)
                {
                    case HexaKind.Cornfield :
                        title = Strings.MESSAGE_TITLE_MIRACLE;
                        description = Strings.MESSAGE_DESCRIPTION_MIRACLE_CORNFIELD;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMill);
                        break;
                    case HexaKind.Pasture :
                        title = Strings.MESSAGE_TITLE_MIRACLE;
                        description = Strings.MESSAGE_DESCRIPTION_MIRACLE_PASTURE;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherd);
                        break;
                    case HexaKind.Stone :
                        title = Strings.MESSAGE_TITLE_MIRACLE;
                        description = Strings.MESSAGE_DESCRIPTION_MIRACLE_STONE;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarry);
                        break;
                    case HexaKind.Forest :
                        title = Strings.MESSAGE_TITLE_MIRACLE;
                        description = Strings.MESSAGE_DESCRIPTION_MIRACLE_FOREST;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconSaw);
                        break;
                    case HexaKind.Mountains :
                        title = Strings.MESSAGE_TITLE_MIRACLE;
                        description = Strings.MESSAGE_DESCRIPTION_MIRACLE_MOUNTAINS;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMine);
                        break;
                }
            }
            else
            {
                switch (hexaKind)
                {
                    case HexaKind.Cornfield:
                        title = Strings.MESSAGE_TITLE_DISASTER;
                        description = Strings.MESSAGE_DESCRIPTION_DISASTER_CORNFIELD;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMill);
                        break;
                    case HexaKind.Pasture:
                        title = Strings.MESSAGE_TITLE_DISASTER;
                        description = Strings.MESSAGE_DESCRIPTION_DISASTER_PASTURE;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherd);
                        break;
                    case HexaKind.Stone:
                        title = Strings.MESSAGE_TITLE_DISASTER;
                        description = Strings.MESSAGE_DESCRIPTION_DISASTER_STONE;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarry);
                        break;
                    case HexaKind.Forest:
                        title = Strings.MESSAGE_TITLE_DISASTER;
                        description = Strings.MESSAGE_DESCRIPTION_DISASTER_FOREST;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconSaw);
                        break;
                    case HexaKind.Mountains:
                        title = Strings.MESSAGE_TITLE_DISASTER;
                        description = Strings.MESSAGE_DESCRIPTION_DISASTER_MOUNTAINS;
                        icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMine);
                        break;
                }
            }

            Message.Inst().Show(title, description, icon);
        }