Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. public void resetClient()
  2. {
  3. try
  4. {
  5. Debug.Log(gms.MaxIPNum);
  6. IPNum = gms.MaxIPNum;
  7. gms.clients = new List<GameObject>();
  8. gms.CurrentIPAddresses = new List<string>();
  9.  
  10. for (int i = 0; i < IPNum; i++)
  11. {
  12. string res = "";
  13. for (int j = 0; j < 4; i++)
  14. {
  15. int a = rand.Next(0, 255);
  16. res = res + a.ToString() + ".";
  17. }
  18. gms.CurrentIPAddresses.Add(res);
  19. res.Remove(res.Length - 1);
  20.  
  21. var instantiatedClient = Instantiate(clientPrefab);
  22. Client clientScript = instantiatedClient.GetComponent<Client>();
  23. clientScript.IPAddress = res;
  24. clientScript.passwordProtected = false;
  25. gms.clients.Add(instantiatedClient);
  26. Debug.Log("ran");
  27. }
  28. }
  29. catch (Exception e)
  30. {
  31. Debug.LogException(e);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement