Best method for sync
Options
Hi which method is best for this like Unet sync?
If I use RPC where I have to call this void turner?
Because from Unet script I can't see any calls.
Let's move further....
Inside "Start" function I can
see Turn value is setted equal to string "First";
there is another function
[SyncVar(hook = "turner")] public string Turn; public void turner(string value) { Turn = value; }PunRPC is good?
If I use RPC where I have to call this void turner?
Because from Unet script I can't see any calls.
Let's move further....
Inside "Start" function I can
see Turn value is setted equal to string "First";
void Start () { i = 0; Turn = "First"; for (int i = 0; i < 32; i++) { cards[i] = i + 1; } cards[9] = 17; pName01 = playerMass[0]; pName02 = playerMass[1]; pName03 = playerMass[2]; pName04 = playerMass[3]; NLM = GameObject.Find("LobbyManager").GetComponent<NetworkLobbyManager>(); timerSound = GetComponent<AudioSource>(); NewRound = true; isTimer = false; isEndGame = false; isScore = false; //DontDestroyOnLoad(gameObject); }It's too complicated
there is another function
test("First"); // Calls from Update ()
public void test(string turn) { StartCoroutine(WaitAndTurn(turn)); }And looks like finaly here "string Turn"
public IEnumerator WaitAndTurn(string turn) { for (int i = 90; i >= 0; i--) { if (_timer != null) { _timer.text = i.ToString(); } yield return new WaitForSeconds(1f); if (Turn != turn) { if (turn == "First") { test("Second"); break; } else if (turn == "Second") { test("Third"); break; } else if (turn == "Third") { test("Fourth"); break; } else if (turn == "Fourth") { test("First"); break; } } if (i == 60) { timerSound.Play(); } else if (i == 30) { timerSound.Play(); } else if (i == 0) { i = 0; isEndGame = true; NewRound = true; print("Game over! AFK is too long!"); } } }So which method is good for me? Sample script will be great. Thank you.
0