static void Main(string[] args) { Console.Write("Digite o tamanho em metros quadrados da área a ser pintada: "); var area = float.Parse(Console.ReadLine()); Console.WriteLine(); var paintCan = new PaintCan(area); var paintGallon = new PaintGallon(area); var paintCanAndGallon = new PaintCanAndGallon(area); Console.WriteLine("Comprar apenas latas de 18 litros"); Console.WriteLine($"Quantidade: {paintCan.CalculateAmount()}"); Console.WriteLine($"Preço: R${paintCan.CalculatePrice():F2}"); Console.WriteLine(); Console.WriteLine("Comprar apenas galões de 3,6 litros"); Console.WriteLine($"Quantidade: {paintGallon.CalculateAmount()}"); Console.WriteLine($"Preço: R${paintGallon.CalculatePrice():F2}"); Console.WriteLine(); Console.WriteLine("Misturar latas e galões, de forma que o desperdício de tinta seja menor"); Console.WriteLine($"Quantidade de latas: {paintCanAndGallon.CalculateAmount().paintCans}"); Console.WriteLine($"Preço das latas: R${paintCanAndGallon.CalculatePrice().paintCansPrice:F2}"); Console.WriteLine($"Quantidade de galões: {paintCanAndGallon.CalculateAmount().paintGallons}"); Console.WriteLine($"Preço dos galões: R${paintCanAndGallon.CalculatePrice().paintGallonsPrice:F2}"); Console.WriteLine(); }
public GameWorld(ContentManager Content) { background = Content.Load <Texture2D>("spr_background"); cannon = new Cannon(Content); ball = new Ball(Content); can1 = new PaintCan(Content, 480.0f, Color.Red); can2 = new PaintCan(Content, 610.0f, Color.Green); can3 = new PaintCan(Content, 740.0f, Color.Blue); }
/// <summary> /// Creates a new GameWorld instance. /// This method loads all relevant MonoGame assets and initializes all game objects: /// the cannon, the ball, and the paint cans. /// It also initializes all other variables so that the game can start. /// </summary> /// <param name="Content">A ContentManager object, required for loading assets.</param> public GameWorld(ContentManager Content) { // load sprites and fonts gameover = Content.Load <Texture2D>("spr_gameover"); livesSprite = Content.Load <Texture2D>("spr_lives"); background = Content.Load <Texture2D>("spr_background"); scoreBar = Content.Load <Texture2D>("spr_scorebar"); gameFont = Content.Load <SpriteFont>("PainterFont"); // initialize game objects: cannon, ball, and paint cans cannon = new Cannon(Content); ball = new Ball(Content); can1 = new PaintCan(Content, 480.0f, Color.Red); can2 = new PaintCan(Content, 610.0f, Color.Green); can3 = new PaintCan(Content, 740.0f, Color.Blue); // initialize the score and the number of lives Score = 0; lives = 5; }