Beispiel #1
0
 public Hexagon GetHexagonAtPosition(HexagonPosition hexagonPosition)
 {
     if (!Hexagons.ContainsKey(hexagonPosition))
     {
         return(null);
     }
     return(Hexagons[hexagonPosition]);
 }
Beispiel #2
0
        public Hexagon RevealHexagonAt(HexagonPosition hexagonPosition)
        {
            if (Hexagons.ContainsKey(hexagonPosition))
            {
                throw new InvalidOperationException($"The hexagon was already revealed. Use Indexer or {nameof(GetHexagonAtPosition)} instead.");
            }
            var hexagon = HexagonRevealer.GenerateHexagonAt(hexagonPosition);

            Hexagons.Add(hexagonPosition, hexagon);
            HexagonRevealed?.Invoke(this, hexagon);
            return(hexagon);
        }