Exemple #1
0
        public SettlementCtrl GetSettlement(SettlementKey key)
        {
            SettlementCtrl retSettlement = null;

            TileLocToSettlementData.TryGetValue(key, out retSettlement);
            return(retSettlement);
        }
Exemple #2
0
        } = new Dictionary <SettlementKey, SettlementCtrl>(new KeyComparer());                                                                                // lookup table used for envent handlers

        //
        //  returns all Settlements associated with the control, or NULL if none are
        public SettlementCtrl GetSettlement(SettlementCtrl control)
        {
            SettlementCtrl retSettlement = null;

            SettlementCtrlToSettlementData.TryGetValue(control, out retSettlement);
            return(retSettlement);
        }
Exemple #3
0
 internal void RemoveSettlement(SettlementCtrl settlement)
 {
     Settlements.Remove(settlement);
 }
Exemple #4
0
 internal void AddSettlement(SettlementCtrl settlement)
 {
     Settlements.Add(settlement);
 }
Exemple #5
0
 public SettlementData(TileCtrl t, SettlementCtrl setttlement)
 {
     Tile       = t;
     Location   = setttlement.SettlementLocation;
     Settlement = setttlement;
 }
Exemple #6
0
        private void AddSameSettlementLocationToDictionary(TileCtrl tile, SettlementCtrl inputSettlementCtrl)
        {
            RoadLocation[]       adjTileLocations   = null;
            SettlementLocation[] settlementLocation = null;
            SettlementLocation   inputLocation      = inputSettlementCtrl.SettlementLocation;

            switch (inputLocation)
            {
            case SettlementLocation.TopRight:
                adjTileLocations = new RoadLocation[3] {
                    RoadLocation.None, RoadLocation.Top, RoadLocation.TopRight
                };
                settlementLocation = new SettlementLocation[3] {
                    inputLocation, SettlementLocation.BottomRight, SettlementLocation.MiddleLeft
                };
                break;

            case SettlementLocation.MiddleRight:
                adjTileLocations = new RoadLocation[3] {
                    RoadLocation.None, RoadLocation.TopRight, RoadLocation.BottomRight
                };
                settlementLocation = new SettlementLocation[3] {
                    inputLocation, SettlementLocation.BottomLeft, SettlementLocation.TopLeft
                };
                break;

            case SettlementLocation.BottomRight:
                adjTileLocations = new RoadLocation[3] {
                    RoadLocation.None, RoadLocation.BottomRight, RoadLocation.Bottom
                };
                settlementLocation = new SettlementLocation[3] {
                    inputLocation, SettlementLocation.MiddleLeft, SettlementLocation.TopRight
                };
                break;

            case SettlementLocation.BottomLeft:
                adjTileLocations = new RoadLocation[3] {
                    RoadLocation.None, RoadLocation.Bottom, RoadLocation.BottomLeft
                };
                settlementLocation = new SettlementLocation[3] {
                    inputLocation, SettlementLocation.TopRight, SettlementLocation.MiddleRight
                };
                break;

            case SettlementLocation.MiddleLeft:
                adjTileLocations = new RoadLocation[3] {
                    RoadLocation.None, RoadLocation.BottomLeft, RoadLocation.TopLeft
                };
                settlementLocation = new SettlementLocation[3] {
                    inputLocation, SettlementLocation.TopRight, SettlementLocation.BottomRight
                };
                break;

            case SettlementLocation.TopLeft:
                adjTileLocations = new RoadLocation[3] {
                    RoadLocation.None, RoadLocation.TopLeft, RoadLocation.Top
                };
                settlementLocation = new SettlementLocation[3] {
                    inputLocation, SettlementLocation.MiddleRight, SettlementLocation.BottomLeft
                };
                break;

            case SettlementLocation.None:
                break;

            default:
                break;
            }

            AddSettlementClonesToDictionary(tile, adjTileLocations, settlementLocation);
        }