Guest User

Untitled

a guest
Oct 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. Rule rule2 = new Rule(); // initiate the class
  2. Debug.Log(rule2); //1st debug
  3. rule2.RuleSetup(r: "CaughtEnough", li: 0); //setting up the parameters
  4. Debug.Log(rule2.rule); //2nd debug
  5.  
  6. null
  7. UnityEngine.Debug:Log(Object)
  8.  
  9. CaughtEnough
  10. UnityEngine.Debug:Log(Object)
  11.  
  12. Invoke(rule, 0f);
  13.  
  14. CaughtEnough();
  15.  
  16. public class Rule : MonoBehaviour {
  17.  
  18. public string rule;
  19.  
  20. public int leftInt;
  21. public Dictionary<string, int> leftDict;
  22. public float countdown;
  23.  
  24. public int outcome;
  25.  
  26. public CatchManager catchMan;
  27. public Net net;
  28.  
  29. // Use this for initialization
  30. void Start () {
  31. RuleSetup();
  32. }
  33.  
  34. public void RuleSetup(string r = "NoRule", int li = 0, Dictionary<string, int> ld = null, float cd = float.PositiveInfinity) {
  35. rule = r;
  36. leftInt = li;
  37. leftDict = ld;
  38. countdown = cd;
  39. }
  40. .....
  41.  
  42. public class Rule : MonoBehaviour{}
  43. Rule rule2 = new Rule();
  44.  
  45. public class Rule : MonoBehaviour
  46. {
  47. public Rule(int i)
  48. {
  49.  
  50. }
  51. }
  52.  
  53. Rule rule2 = null;
  54. void Start()
  55. {
  56. rule2 = gameObject.AddComponent<Rule>();
  57. }
  58.  
  59. public Rule rulePrefab;
  60. Rule rule2;
  61. void Start()
  62. {
  63. rule2 = Instantiate(rulePrefab) as Rule;
  64. }
  65.  
  66. Rule rule2;
  67. void Start()
  68. {
  69. rule2 = GameObject.Find("NameObjectScriptIsAttachedTo").GetComponent<Rule>();
  70. }
  71.  
  72. public class Rule
  73. {
  74. public Rule(int i)
  75. {
  76.  
  77. }
  78. }
  79.  
  80. Rule rule2 = null;
  81.  
  82. void Start()
  83. {
  84. rule2 = new Rule(3);
  85. }
Add Comment
Please, Sign In to add comment