@ -151,11 +151,25 @@ public class GameManager : MonoBehaviour
playerData = new Dictionary < int , PlayerData > ( ) ;
Block [ ] SpawnBlocks = FindObjectsOfType < Block > ( ) . Where ( p = > p . isSpawnable ) . ToArray ( ) ;
int spawnIndex = 0 ;
int blockIndex = 0 ;
foreach ( Block block in SpawnBlocks )
{
Debug . Log ( "Block #" + blockIndex + + + " (" + block . transform . position . x + ", " + block . transform . position . y + ", " + block . transform . position . z + ")" ) ;
}
//int spawnIndex = 0;
//If we have an odd number of players, then we start at spawn point 0 (in the middle)
//If we have an even number, then we skip it
int spawnIndex = ( ( ClientList . Count ( ) + 1 ) % 2 ) ;
//int spawnIndex = 0;
foreach ( ClientData client in ClientList )
{
Debug . Log ( "spawnIndex = " + spawnIndex ) ;
Character newChar = Instantiate ( characterPrefab ) ;
Block startingBlock = SpawnBlocks [ ( spawnIndex + + % ClientList . ConnectedClients . Count ) ] ;
//Block startingBlock = SpawnBlocks[(spawnIndex++ % ClientList.ConnectedClients.Count)];
Block startingBlock = SpawnBlocks [ spawnIndex + + ] ;
newChar . Initialise ( startingBlock , client . Inventory , client . characterAnimal ) ;
newChar . transform . forward = startingBlock . SpawnDirection . ToVector ( ) ;
playerData . Add ( client . ID , new PlayerData ( newChar , client ) ) ;