Advertisement
NomadicWarrior

Game script

Mar 5th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.24 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.Networking;
  6.  
  7. public class Game : NetworkBehaviour
  8. {
  9. public GameObject _singleton;
  10. public Singleton _singletonScript;
  11.  
  12. public GameObject _text;
  13. public Text TextTest;
  14.  
  15. public int[] cards = new int[32];
  16. public int _endTurnScore;
  17. public int _teamOneScore;
  18. public int _teamTwoScore;
  19.  
  20. private GameObject TakePoint01;
  21. private GameObject TakePoint02;
  22. private GameObject TakePoint03;
  23. private GameObject TakePoint04;
  24.  
  25. public GameObject Center;
  26. public GameObject Card;
  27. public CardScript cardScript;
  28.  
  29. public string[] _playerNames = new string[4];
  30.  
  31. public string TEXT = "";
  32.  
  33. public GameObject[] Player;
  34. public Player _player;
  35.  
  36. public bool isEngGameGame = false;
  37.  
  38. public void onButtonDown()
  39. {
  40. isEngGameGame = true;
  41. }
  42.  
  43. void Start ()
  44. {
  45. _singleton = GameObject.Find("SINGLETON");
  46. _singletonScript = _singleton.GetComponent<Singleton>();
  47.  
  48. _text = GameObject.FindGameObjectWithTag("text");
  49.  
  50. TakePoint01 = GameObject.FindGameObjectWithTag("TakePoint01");
  51. TakePoint02 = GameObject.FindGameObjectWithTag("TakePoint02");
  52. TakePoint03 = GameObject.FindGameObjectWithTag("TakePoint03");
  53. TakePoint04 = GameObject.FindGameObjectWithTag("TakePoint04");
  54.  
  55. //print(_playerNames[0]);
  56. //StartCoroutine(WaitCardRecieve(1f));
  57. }
  58.  
  59. private void Update()
  60. {
  61. if (_text != null)
  62. {
  63. TextTest = _text.GetComponent<Text>();
  64. }
  65. }
  66.  
  67. public void SendText(string x)
  68. {
  69. TEXT = x;
  70. }
  71.  
  72. GameObject[] cardsMass = new GameObject[4];
  73.  
  74. public void CardDroping(int x, bool y, GameObject z)
  75. {
  76. cardsMass[x] = z;
  77.  
  78. if (y == true)
  79. {
  80. int c1,c2,c3,c4;
  81.  
  82. c1 = cardsMass[0].GetComponent<CardScript>().cardScore;
  83. c2 = cardsMass[1].GetComponent<CardScript>().cardScore;
  84. c3 = cardsMass[2].GetComponent<CardScript>().cardScore;
  85. c4 = cardsMass[3].GetComponent<CardScript>().cardScore;
  86.  
  87. if (c1 > c2 && c1 > c3 && c1 > c4)
  88. {
  89. cardsMass[0].transform.position = TakePoint01.transform.position;
  90. cardsMass[1].transform.position = TakePoint01.transform.position;
  91. cardsMass[2].transform.position = TakePoint01.transform.position;
  92. cardsMass[3].transform.position = TakePoint01.transform.position;
  93. }
  94. else if (c2 > c1 && c2 > c3 && c2 > c4)
  95. {
  96. cardsMass[0].transform.position = TakePoint02.transform.position;
  97. cardsMass[1].transform.position = TakePoint02.transform.position;
  98. cardsMass[2].transform.position = TakePoint02.transform.position;
  99. cardsMass[3].transform.position = TakePoint02.transform.position;
  100. }
  101. else if (c3 > c1 && c3 > 2 && c3 > c4)
  102. {
  103. cardsMass[0].transform.position = TakePoint03.transform.position;
  104. cardsMass[1].transform.position = TakePoint03.transform.position;
  105. cardsMass[2].transform.position = TakePoint03.transform.position;
  106. cardsMass[3].transform.position = TakePoint03.transform.position;
  107. }
  108. else if (c4 > c1 && c4 > c2 && c4 > c3)
  109. {
  110. cardsMass[0].transform.position = TakePoint04.transform.position;
  111. cardsMass[1].transform.position = TakePoint04.transform.position;
  112. cardsMass[2].transform.position = TakePoint04.transform.position;
  113. cardsMass[3].transform.position = TakePoint04.transform.position;
  114. }
  115.  
  116. EndTurnScore(cardsMass[0].GetComponent<CardScript>().cardScore, cardsMass[1].GetComponent<CardScript>().cardScore, cardsMass[2].GetComponent<CardScript>().cardScore, cardsMass[3].GetComponent<CardScript>().cardScore);
  117. }
  118. }
  119.  
  120. public void EndTurnScore(int c1, int c2, int c3, int c4)
  121. {
  122. _endTurnScore = c1 + c2 + c3 + c4;
  123. print(_endTurnScore);
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement