private GameObject PickStartSpawnPoint(PaintBallPlayer player) { //we take pedestal index as spawnpoint PaintBallSpawnPoint point = spawnPoints.Where(x => x.startSpawnIndex == player.myPedestalIndex).ToList()[0]; //pick random one return(point.gameObject); }
private GameObject PickRandomSpawnPoint(TEAM playerTeam) { //get all avalilible points List <PaintBallSpawnPoint> availiblePoints = spawnPoints.Where(x => x.team == playerTeam).Where(x => x.isOccupied == false).ToList(); //pick random one int randomIndex = Random.Range(0, availiblePoints.Count); PaintBallSpawnPoint randomPoint = availiblePoints[randomIndex]; //occupy this point randomPoint.isOccupied = true; return(randomPoint.gameObject); }