Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. using System.Collections;
  2. using System;
  3.  
  4. public enum TowerType
  5. {
  6. tA,
  7. tB,
  8. tC
  9. };
  10.  
  11. public class Tower {
  12.  
  13. private TowerType type;
  14. private int damage;
  15. private int range;
  16. private int health;
  17.  
  18. public Tower(TowerType type)
  19. {
  20. this.type = type;
  21. initializeVariables();
  22. }
  23.  
  24. private void initializeVariables()
  25. {
  26. if (this.type != null)
  27. {
  28. if (this.type == TowerType.tA)
  29. {
  30. this.damage = 20;
  31. this.range = 40;
  32. this.health = 50;
  33. }
  34.  
  35. else if (this.type == TowerType.tB)
  36. {
  37. this.damage = 30;
  38. this.range = 50;
  39. this.health = 60;
  40. }
  41.  
  42. else if (this.type == TowerType.tC)
  43. {
  44. this.damage = 60;
  45. this.range = 60;
  46. this.health = 80;
  47. }
  48.  
  49. }
  50. }
  51.  
  52. public int getDamage()
  53. {
  54. return this.damage;
  55. }
  56.  
  57. public int getRange()
  58. {
  59. return this.range;
  60. }
  61.  
  62. public int getHealth()
  63. {
  64. return this.health;
  65. }
  66.  
  67. public TowerType getTowerType()
  68. {
  69. return this.type;
  70. }
  71.  
  72. public string getType(int value)
  73. {
  74. return Enum.GetName(typeof(TowerType), value);
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement