using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class StrartGame : NetworkBehaviour
{
int wolf = 2; //random value 0
int mura = 3; //random value 1
int witch = 1; //random value 2
int kami = 1; //random value 3
int hunter = 1; //random value 4
GameObject[] players;
public void StartBttn()
{
players = GameObject.FindGameObjectsWithTag("nothing");
bool succces = false;
PlayerSet.start = true;
if(players.Length >= 8)
{
foreach (GameObject player in players)
{
succces = false;
while (!succces)
{
int ran = Random.Range(0, 5);
if(ran == 0 && wolf > 0)
{
player.GetComponent<PlayerSet>().TagSet("wolf");
wolf--;
succces = true;
}
else if(ran == 1 && mura > 0)
{
player.GetComponent<PlayerSet>().TagSet("mura");
mura--;
succces = true;
}
else if(ran == 2 && witch > 0)
{
player.GetComponent<PlayerSet>().TagSet("witch");
witch--;
succces = true;
}
else if(ran == 3 && kami > 0)
{
player.GetComponent<PlayerSet>().TagSet("kami");
kami--;
succces = true;
}
else if(ran == 4 && hunter > 0)
{
player.GetComponent<PlayerSet>().TagSet("hunter");
hunter--;
succces = true;
}
}
}
foreach(GameObject player in players)
{
player.GetComponent<PlayerSet>().SetBool();
}
}
}
}