Advertisement
Guest User

gra

a guest
Feb 25th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp17
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Profesja kupiec = new Profesja("Kupiec", 0, -10);
  14. Profesja wojownik = new Profesja("Wojownik", 15, 10);
  15.  
  16.  
  17. Console.ReadKey();
  18. }
  19. }
  20.  
  21. class Profesja
  22. {
  23. public Profesja(string nazwa, float atk, float obr)
  24. {
  25. Nazwa = nazwa;
  26. BonusDoAtaku = atk;
  27. BonusDoObrony = obr;
  28. }
  29.  
  30. public string Nazwa;
  31. public float BonusDoAtaku;
  32. public float BonusDoObrony;
  33. }
  34.  
  35. class Postac
  36. {
  37. public string Imie;
  38. public Profesja Profesja;
  39. public float PunktyZycia;
  40. public float PunktyAtaku;
  41. public float PunktyObrony;
  42.  
  43. public Postac()
  44. {
  45. PunktyZycia = 100f;
  46. }
  47.  
  48. public Postac(string imie, Profesja profesja, float atk, float obr)
  49. {
  50. PunktyZycia = 100f;
  51. Imie = imie;
  52. Profesja = profesja;
  53. PunktyAtaku = atk;
  54. PunktyObrony = obr;
  55. }
  56.  
  57. public bool CzyZyje()
  58. {
  59. if(PunktyZycia > 0)
  60. {
  61. return true;
  62. }
  63. return false;
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement