fork download
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Networking;
  5.  
  6. public class StrartGame : NetworkBehaviour
  7. {
  8. int wolf = 2; //random value 0
  9. int mura = 3; //random value 1
  10. int witch = 1; //random value 2
  11. int kami = 1; //random value 3
  12. int hunter = 1; //random value 4
  13. GameObject[] players;
  14. public void StartBttn()
  15. {
  16. players = GameObject.FindGameObjectsWithTag("nothing");
  17. bool succces = false;
  18. PlayerSet.start = true;
  19.  
  20. if(players.Length >= 8)
  21. {
  22. foreach (GameObject player in players)
  23. {
  24. succces = false;
  25. while (!succces)
  26. {
  27. int ran = Random.Range(0, 5);
  28. if(ran == 0 && wolf > 0)
  29. {
  30. player.GetComponent<PlayerSet>().TagSet("wolf");
  31. wolf--;
  32. succces = true;
  33. }
  34. else if(ran == 1 && mura > 0)
  35. {
  36. player.GetComponent<PlayerSet>().TagSet("mura");
  37. mura--;
  38. succces = true;
  39. }
  40. else if(ran == 2 && witch > 0)
  41. {
  42. player.GetComponent<PlayerSet>().TagSet("witch");
  43. witch--;
  44. succces = true;
  45. }
  46. else if(ran == 3 && kami > 0)
  47. {
  48. player.GetComponent<PlayerSet>().TagSet("kami");
  49. kami--;
  50. succces = true;
  51. }
  52. else if(ran == 4 && hunter > 0)
  53. {
  54. player.GetComponent<PlayerSet>().TagSet("hunter");
  55. hunter--;
  56. succces = true;
  57. }
  58. }
  59. }
  60.  
  61. foreach(GameObject player in players)
  62. {
  63. player.GetComponent<PlayerSet>().SetBool();
  64. }
  65.  
  66. }
  67. }
  68. }
  69.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(3,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(4,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(6,27): error CS0246: The type or namespace name `NetworkBehaviour' could not be found. Are you missing an assembly reference?
prog.cs(13,5): error CS0246: The type or namespace name `GameObject' could not be found. Are you missing an assembly reference?
Compilation failed: 4 error(s), 0 warnings
stdout
Standard output is empty