Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.32 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CharacterBaseStats : MonoBehaviour {
  5.  
  6. public int endurance = 0;
  7. public int intelligence = 0;
  8. public int agility = 0;
  9. public int perception = 0;
  10. public int courage = 0;
  11. public int carriable_weight = 20;
  12. public int health = 50;
  13. public bool medic = false;
  14. public bool hacker = false;
  15. public bool soldier = false;
  16. public bool psychic = false;
  17. public bool trapper = false;
  18.  
  19.  
  20. public CharacterBaseStats(int endurance, int intelligence, int agility, int perception, int courage, int carriable_weight, int health)
  21. {
  22. this.health = health;
  23. this.endurance = endurance;
  24. this.intelligence = intelligence;
  25. this.perception = perception;
  26. this.courage = courage;
  27. this.carriable_weight = carriable_weight;
  28. }
  29. private int getEndurance()
  30. {
  31. return endurance;
  32. }
  33.  
  34. private void increaseEndurance()
  35. {
  36. endurance = endurance + 1;
  37. }
  38.  
  39. private int getIntelligence()
  40. {
  41. return intelligence;
  42. }
  43.  
  44. private void increaseIntelligence()
  45. {
  46. intelligence = intelligence +1;
  47. }
  48.  
  49. private int getAgility()
  50. {
  51. return agility;
  52. }
  53.  
  54. private void increaseagility()
  55. {
  56. agility = agility +1;
  57. }
  58.  
  59. private int getPerception()
  60. {
  61. return perception;
  62. }
  63.  
  64. private void increasePerception()
  65. {
  66. perception = perception +1;
  67. }
  68.  
  69. private int getCarriableWeight()
  70. {
  71. return carriable_weight;
  72. }
  73.  
  74. private void setCarriableWeight()
  75. {
  76. carriable_weight = endurance * 2;
  77. }
  78.  
  79. public void generateCharacter()
  80. {
  81. int points_at_start = 20;
  82. int Char_class = Random.Range(1, 6);
  83. switch(Char_class)
  84. {
  85. case 1:
  86. {
  87. medic = true;
  88. break;
  89. }
  90. case 2:
  91. {
  92. hacker = true;
  93. break;
  94.  
  95. }
  96. case 3:
  97. {
  98. soldier = true;
  99. break;
  100.  
  101. }
  102. case 4:
  103. {
  104. psychic = true;
  105. break;
  106.  
  107. }
  108. case 5:
  109. {
  110. trapper = true;
  111. break;
  112. }
  113. }
  114. do{
  115. int stat = Random.Range(1, 5);
  116. switch(stat)
  117. {
  118. case 1:
  119. {
  120. endurance = Random.Range(0, points_at_start);
  121. points_at_start -= endurance;
  122. if(medic == true)
  123. {
  124. endurance += 5;
  125. }else if(hacker == true)
  126. {
  127. endurance += 0;
  128. }else if(trapper == true)
  129. {
  130. endurance += 2;
  131. }else if(psychic == true)
  132. {
  133. endurance += 10;
  134. }
  135. else //soldier
  136. {
  137. endurance += 15;
  138. }
  139. break;
  140. }
  141. case 2:
  142. {
  143. intelligence = Random.Range(0, points_at_start);
  144. points_at_start -= agility;
  145. if(medic == true)
  146. {
  147. intelligence += 15;
  148. }else if(hacker == true)
  149. {
  150. intelligence += 20;
  151. }else if(trapper == true)
  152. {
  153. intelligence += 10;
  154. }else if(psychic == true)
  155. {
  156. intelligence += 15;
  157. }
  158. else //soldier
  159. {
  160. intelligence += 0;
  161. }
  162. break;
  163. }
  164. case 3:
  165. {
  166. agility = Random.Range(0, points_at_start);
  167. points_at_start -= agility;
  168. if(medic == true)
  169. {
  170. agility += 5;
  171. }else if(hacker == true)
  172. {
  173. agility += 5;
  174. }else if(trapper == true)
  175. {
  176. agility += 10;
  177. }else if(psychic == true)
  178. {
  179. agility += 0;
  180. }
  181. else //soldier
  182. {
  183. agility += 10;
  184. }
  185. break;
  186. }
  187. case 4:
  188. {
  189. courage = Random.Range(0, points_at_start);
  190. points_at_start -= courage;
  191. if(medic == true)
  192. {
  193. courage += 0;
  194. }else if(hacker == true)
  195. {
  196. courage += 0;
  197. }else if(trapper == true)
  198. {
  199. courage += 5;
  200. }else if(psychic == true)
  201. {
  202. courage += 5;
  203. }
  204. else //soldier
  205. {
  206. courage += 10;
  207. }
  208. break;
  209. }
  210. case 5:
  211. {
  212. perception = Random.Range(0, points_at_start);
  213. points_at_start -= courage;
  214. if(medic == true)
  215. {
  216. perception += 5;
  217. }else if(hacker == true)
  218. {
  219. perception += 5;
  220. }else if(trapper == true)
  221. {
  222. perception += 10;
  223. }else if(psychic == true)
  224. {
  225. perception += 20;
  226. }
  227. else //soldier
  228. {
  229. perception += 0;
  230. }
  231. break;
  232. }
  233. }
  234.  
  235. }while(points_at_start != 0);
  236. }
  237.  
  238. public string toStringChar()
  239. {
  240. return "Endurance:" + getEndurance() + ", Intelligence:" + getIntelligence() + ", Agility:" + getAgility() + ", Perception:" + getPerception() + ", Carriable Weight:" + getCarriableWeight();
  241. }
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement