コード例 #1
0
ファイル: Runner.cs プロジェクト: Corniel/AIGames.Warlight2
        private void ParseSetupMap(string line, string[] tokens)
        {
            switch (tokens[1])
            {
            case "super_regions":
                this.Map.Setup(SetupSuperRegionsInstruction.Detokenize(tokens)); break;

            case "regions":
                this.Map.Setup(SetupRegionsInstruction.Detokenize(tokens)); break;

            case "neighbors":
                this.Map.Setup(SetupNeighborInstruction.Detokenize(tokens)); break;
            }
        }
コード例 #2
0
        /// <summary>Handles the setup instruction.</summary>
        public void Setup(SetupNeighborInstruction instruction)
        {
            Guard.NotNull(instruction, "instruction");

            foreach (var info in instruction.Neighbors)
            {
                var region = this[info.Id];

                foreach (var nId in info.Neighbors)
                {
                    var neighbor = this[nId];
                    region.AddNeighbor(neighbor);
                }
            }
        }