コード例 #1
0
ファイル: Board.cs プロジェクト: SamCharette/HexGame-v1
        private void CreateVertices(int size)
        {
            for (var row = 0; row < size; row++)
            {
                for (var column = 0; column < size; column++)
                {
                    var hex = new Vertex(row, column);
                    if (row == 0)
                    {
                        ConnectVertices(hex, Top);
                    }

                    if (row == Size - 1)
                    {
                        ConnectVertices(hex, Bottom);
                    }

                    if (column == 0)
                    {
                        ConnectVertices(hex, Left);
                    }

                    if (column == Size - 1)
                    {
                        ConnectVertices(hex, Right);
                    }
                    Hexes.Add(hex);
                }
            }
        }
コード例 #2
0
 // add hex and its neighbours to list
 public void AddHex(Hex hex)
 {
     hex.City = this;
     //ResourceBalance = ResourceBalance + tile.Resources;
     //foreach (NaturalGood resource in hexes.Resources)
     //{
     //    //ResourceBalance.NormalResourcesQuantity[resource.Info.Name] += resource.ResourceQuantity;
     //}
     Hexes.Add(hex);
 }