// ładujemy się private static void Recharge() { int added = agentTomek.Recharge(); energy += added; Console.WriteLine("Otrzymano " + added + " energii"); }
private static void Recharge() { int added = agentTomek.Recharge(); if (energy + added >= cennikSwiata.initialEnergy) { int roznica = cennikSwiata.initialEnergy - energy; energy = cennikSwiata.initialEnergy; Console.WriteLine("Otrzymano " + roznica + " energii"); } else { energy += added; Console.WriteLine("Otrzymano " + added + " energii"); } energy += added; Console.WriteLine("Otrzymano " + added + " energii"); }