/// <summary> /// Render a coinpack. /// </summary> /// <param name="coinpack">Coinpack model</param> /// <param name="squareSize">Maximum size of the containing square</param> /// <returns></returns> private static Rectangle RenderCoinpack(Coinpack coinpack, int squareSize) { var rectangle = new Rectangle { Height = squareSize, Width = squareSize, Fill = new VisualBrush( new PackIconMaterial { Kind = PackIconMaterialKind.Coin, Foreground = new SolidColorBrush(Colors.Gold), Effect = new DropShadowEffect { Color = Colors.Gold, Direction = 0, Opacity = 1, ShadowDepth = 0 } } ), Stroke = new SolidColorBrush(Colors.DimGray) }; return(rectangle); }
/// <summary> /// Adds a new coinpack to the world. /// </summary> /// <param name="oldWorld">Current state of the world. </param> /// <param name="message">The CoinpackMessage received. </param> /// <returns>New world based on both the old world and the CoinpackMessage. </returns> private static World FromCoinpackMessage(World oldWorld, CoinpackMessage message) { var coinpack = new Coinpack(message.Location, message.CoinValue, message.RemainingTime); return(new World(oldWorld.PlayerNumber) { BrickWalls = oldWorld.BrickWalls, StoneWalls = oldWorld.StoneWalls, Waters = oldWorld.Waters, Tanks = oldWorld.Tanks, Coinpacks = new HashSet <Coinpack>(oldWorld.Coinpacks.Concat(new[] { coinpack })), Lifepacks = oldWorld.Lifepacks }); }