Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 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 Kolos_testowy
  8. {
  9. public enum CharClass
  10. {
  11. warrior,
  12. mage,
  13. archer
  14. }
  15.  
  16. class Character
  17. {
  18. double posx;
  19. double posy;
  20. int level;
  21. string nick;
  22. CharClass charClass;
  23. //public readonly charClass CharClass;
  24.  
  25. private Character(double posx, double posy, int level, string nick, CharClass charClass)
  26. {
  27. this.posx = posx;
  28. this.posy = posy;
  29. this.level = level;
  30. this.nick = nick;
  31.  
  32. }
  33. public static Character generate(double posx, double posy, int level, string nick, CharClass charClass)
  34. {
  35. return new Character(posx, posy, level, nick, charClass);
  36. }
  37. public int Level
  38. {
  39. get
  40. {
  41. return level;
  42. }
  43. }
  44. public string Nick
  45. {
  46. get
  47. {
  48. return nick;
  49. }
  50. }
  51.  
  52.  
  53. }
  54. }
  55.  
  56.  
  57. ////////////////////////////////////////////////////////////////////////
  58. main
  59. //////////////////////////////////////////////////////////////////////////
  60. using System;
  61. using System.Collections.Generic;
  62. using System.Linq;
  63. using System.Text;
  64. using System.Threading.Tasks;
  65.  
  66. namespace Kolos_testowy
  67. {
  68. class Program
  69. {
  70. static void Main(string[] args)
  71. {
  72. Character char1 = Character.generate(3, 1,1,"kasztan", CharClass.archer);
  73. Character char2 = Character.generate(1, 2, 2, "leszcz", CharClass.mage);
  74. Console.WriteLine(char1.Level);
  75. Console.ReadKey();
  76. }
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement