我在一个房间里有 3 名玩家,并设置了 3 个生成位置,但希望每个玩家生成在这些位置之一,而不是在同一个位置。我有这个,但是我怎样才能确保另一个玩家不会在这个出生点生成呢?
number = UnityEngine.Random.Range(1, 3);
if (number == 1)
{
spawnpoint = GameObject.FindWithTag("spawnpoint1");
}
if (number == 2)
{
spawnpoint = GameObject.FindWithTag("spawnpoint2");
}
if (number == 3)
{
spawnpoint = GameObject.FindWithTag("spawnpoint3");
}
GameObject myPlayer = PhotonNetwork.Instantiate(playerprefabname, spawnpoint.transform.position, spawnpoint.transform.rotation, 0);