コード例 #1
0
 private void dupaClk(object sender, RoutedEventArgs e)
 {
     hhg = null;
     Canv.Children.RemoveRange(0, Canv.Children.Count);
     int     size = 40;
     HexGrid hg   = new HexGrid(18, 5, Brushes.Chocolate, size, Canv, null);
 }
コード例 #2
0
ファイル: Field.cs プロジェクト: Mikrus708/StrategyHex
        public static int GetFieldID(this HexagonalHexGrid hhg, int x, int y)
        {
            int z = -x - y;
            int n = hhg.Size;

            return(z + (n * 3 + x - 2) * (n + x - 1) / 2 - (x > 0 ? x * (x - 1) : -x) + n - 1);
        }
コード例 #3
0
        private void loadMap(string name)
        {
            hhg = HexagonalHexGrid.LoadXML(name, Brushes.Purple, 35, Canv, new Point(400, 350));
            var ran = new Random();

            foreach (var he in hhg.Hexes)
            {
                he.MouseDown += reactionToHexClick;
            }
        }
コード例 #4
0
        private void hexdupa(object sender, RoutedEventArgs e)
        {
            Canv.Children.RemoveRange(0, Canv.Children.Count);
            int size = 35;

            hhg = new HexagonalHexGrid(6, Brushes.Purple, size, Canv, new Point(400, 350));
            var ran = new Random();

            foreach (var he in hhg.Hexes)
            {
                he.MouseDown += reactionToHexClick;
                he.Field.Type = (FieldType)(ran).Next(0, Enum.GetValues(typeof(FieldType)).Length);
                he.Field.AddResource(new Resource((ResourceType)(ran).Next(0, Enum.GetValues(typeof(ResourceType)).Length), (uint)ran.Next(100, 1000)));
                he.bru = he.Fill = he.Field.CombinedBrush;
            }
        }
コード例 #5
0
ファイル: Field.cs プロジェクト: Mikrus708/StrategyHex
 public static int GetFieldID(this HexagonalHexGrid hhg, Field field)
 {
     return(hhg.GetFieldID(field.X, field.Y));
 }
コード例 #6
0
ファイル: GameMaster.cs プロジェクト: Mikrus708/StrategyHex
        private List <int[]> _visibleHexs; // [gracz][ID hexa]

        public GameMaster(HexagonalHexGrid grid)
        {
        }