Exemple #1
0
        internal static void DrawHut(this Panel panel, HutPivot hut, double defaultDim, int cityZindex, bool skipPreviousCheck)
        {
            if (panel == null)
            {
                return;
            }

            if (!skipPreviousCheck)
            {
                panel.CleanPreviousChildrenByTag(hut);
            }

            Image img = new Image
            {
                Width               = defaultDim * HUT_DISPLAY_RATIO,
                Height              = defaultDim * HUT_DISPLAY_RATIO,
                Source              = GetBitmap("hut"),
                Stretch             = Stretch.Uniform,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            };

            img.SetValue(Grid.RowProperty, hut.MapSquareLocation.Row);
            img.SetValue(Grid.ColumnProperty, hut.MapSquareLocation.Column);
            img.SetValue(Panel.ZIndexProperty, cityZindex);
            img.Tag = hut;

            panel.Children.Add(img);
        }
Exemple #2
0
        /// <summary>
        /// Adds barbarians to the engine from an <see cref="HutPivot"/>.
        /// </summary>
        /// <param name="hut">The hut.</param>
        public void AddBarbariansFromHut(HutPivot hut)
        {
            if (!hut.IsBarbarians)
            {
                return;
            }

            // MapSquares where a barbarian unit can land.
            var squares = Map.GetAdjacentMapSquares(hut.MapSquareLocation)
                          .Where(ms => !ms.Biome.IsSeaType && !IsCity(ms) && !NotBarbarianPlayers.Any(p => p.Units.Any(u => u.MapSquareLocation == ms)))
                          .ToList();

            if (squares.Count == 0)
            {
                hut.WasEmpty = true;
                return;
            }

            BarbarianPlayer.CreateHordeOfBarbarians(squares);
        }
Exemple #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="hut">The <see cref="Hut"/> value.</param>
 internal DiscoverHutEventArgs(HutPivot hut)
 {
     Hut = hut;
 }