Advertisement
Guest User

quick

a guest
Jun 25th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.97 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5.  
  6. /// <summary>
  7. /// Policy Proposals are the binary choices people are faced with at each area of the game. These are procedurally generated, and
  8. /// CURRENTLY are purely random. This may be a disaster, but meh. Should be fine.
  9. /// </summary>
  10. public class PolicyProposal
  11. {
  12. //The value that'll be increased by this policy
  13. public PolicyArea increasePolicy;
  14. //The value that'll be decreased by this policy
  15. public PolicyArea decreasePolicy;
  16. //How much this policy will cost or save
  17. public int budgetDifference;
  18. //What kind of policy this one is
  19. public PolicyType type;
  20.  
  21. //How the policy will be presented. Use this when displaying the policy.
  22. public string policyString = "";
  23. //The first part of a policy string
  24. private string ppartone = "";
  25. //The second part of a policy string, if there is one
  26. private string pparttwo = "";
  27.  
  28. string[] p1starts =
  29. {
  30. "We must prioritize ", "It's time to focus on ", "We should favour ", "We must shift focus to ", "Our future lies with ", "Australia demands prioritizing "
  31. };
  32. string[] p2starts =
  33. {
  34. "We should invest more in ", "We should increase spending in ", "The government must spend more on ", "It's obvious we need more money in ", "Australia demands more "
  35. };
  36. string[] p3starts =
  37. {
  38. "We could save money by cutting on ", "We should cut back on ", "We don't need as much funding in ", "Lets reduce funding in ", "Australia expects less "
  39. };
  40.  
  41. string[] diffStrings = { " over ", " rather than ", " instead of " };
  42.  
  43. string[] dwords =
  44. {
  45. "Securing Our Borders",
  46. "Stopping The Boats",
  47. "The War on Terror",
  48. "The Defense Force"
  49. };
  50. string[] iwords =
  51. {
  52. "Our Small Businesses",
  53. "A Fair Go for Working Families",
  54. "Moving Forward with Trade",
  55. "Supporting our Big Banks"
  56. };
  57. string[] pwords =
  58. {
  59. "The Gonsky Education Program",
  60. "Laptops in Every School",
  61. "Our Arts Programs",
  62. "Nation Building Programs"
  63. };
  64. string[] ewords =
  65. {
  66. "Saving our Rainforests",
  67. "Renewable Energy Technology",
  68. "Pushing the Carbon Tax",
  69. };
  70.  
  71. //Obiviously.
  72. private static System.Random random = new System.Random();
  73.  
  74. /// <summary>
  75. /// Constructs a PURELY RANDOM policy proposal. Enjoy all those hardcoded values!
  76. /// </summary>
  77. public PolicyProposal()
  78. {
  79. Array areas = Enum.GetValues(typeof(PolicyArea));
  80. int proposalType = random.Next(0, 9);
  81. if (proposalType < 2)
  82. {
  83. int index = random.Next(areas.Length);
  84. increasePolicy = (PolicyArea)areas.GetValue(index);
  85. int index2 = random.Next(areas.Length);
  86. while (index2 == index)
  87. index2 = random.Next(areas.Length);
  88. decreasePolicy = (PolicyArea)areas.GetValue(index2);
  89. budgetDifference = 0;
  90. type = PolicyType.NOBUDGET;
  91.  
  92. }
  93. else if (proposalType < 8)
  94. {
  95. int index = random.Next(areas.Length);
  96. increasePolicy = (PolicyArea)areas.GetValue(index);
  97. budgetDifference = -random.Next(2800, 5200);
  98. type = PolicyType.NODECREASE;
  99. }
  100. else
  101. {
  102. int index = random.Next(areas.Length);
  103. decreasePolicy = (PolicyArea)areas.GetValue(index);
  104. budgetDifference = random.Next(1400, 2600);
  105. type = PolicyType.NOINCREASE;
  106. }
  107.  
  108. GeneratePolicyTopic();
  109. }
  110.  
  111. /// <summary>
  112. /// Small clean representation of the object. For menus etc.
  113. /// </summary>
  114. /// <returns>A string that represents the current object.</returns>
  115. /// <filterpriority>2</filterpriority>
  116. public override string ToString()
  117. {
  118. return ppartone + " " + pparttwo;
  119. /*switch (type)
  120. {
  121. case PolicyType.NOBUDGET:
  122. return "Policy: +" + increasePolicy.ToString() + " -" + decreasePolicy.ToString;
  123. case PolicyType.NODECREASE:
  124. return "Policy: +" + increasePolicy.ToString();
  125. case PolicyType.NOINCREASE:
  126. return "Policy: -" + decreasePolicy.ToString();
  127. }*/
  128. }
  129.  
  130. public void GeneratePolicyTopic() {
  131. if (type == PolicyType.NOINCREASE)
  132. policyString = p3starts [random.Next(0, p3starts.Length)];
  133. else if (type == PolicyType.NODECREASE)
  134. policyString = p2starts [random.Next(0, p2starts.Length)];
  135. else
  136. policyString = p1starts [random.Next(0, p1starts.Length)];
  137.  
  138. PolicyArea area = (type == PolicyType.NOINCREASE ? decreasePolicy : increasePolicy);
  139. ppartone = (type == PolicyType.NOINCREASE ? "-" : "+");
  140.  
  141. string addWord = "";
  142. switch (area)
  143. {
  144. case PolicyArea.DEFENSE:
  145. policyString += dwords [random.Next(0, dwords.Length)];
  146. break;
  147. case PolicyArea.ENVIRONMENT:
  148. policyString += ewords [random.Next(0, ewords.Length)];
  149. break;
  150. case PolicyArea.INDUSTRY:
  151. policyString += iwords [random.Next(0, iwords.Length)];
  152. break;
  153. case PolicyArea.PUBLIC:
  154. policyString += pwords [random.Next(0, pwords.Length)];
  155. break;
  156. }
  157. policyString += addWord;
  158. ppartone += addWord;
  159.  
  160. if (type == PolicyType.NOBUDGET)
  161. {
  162. policyString += diffStrings [random.Next(0, diffStrings.Length)];
  163. string pstring = decreasePolicy.ToString();
  164. policyString += pstring.Substring(0, 1) + pstring.Substring(1).ToLower();
  165. policyString += " spending.";
  166. pparttwo = "-" + decreasePolicy.ToString();
  167. }
  168. }
  169. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement