private void AddNewPlayer(SocketIOEvent evt) //Add each player that joins after this client { if (Dbug) { print("Adding new player"); } PlayerParams pp = PlayerParams.CreateFromJSON(evt.data.ToString()); var newCharacter = Instantiate(otherCharPrefab, pp.getPosition(), Quaternion.Euler(0, -90, 0)); newCharacter.GetComponent <Player>().SetFromPlayerParams(pp); players.Add(pp); playerObjects.Add(newCharacter); }
private void AddExistingPlayer(SocketIOEvent evt) //Add players that joined before this client { PlayerParams pp = PlayerParams.CreateFromJSON(evt.data.ToString()); if (Dbug) { print("Existing player: " + evt.data.ToString()); } var newCharacter = Instantiate(otherCharPrefab, new Vector3(0, 0f, 0f), Quaternion.Euler(0, -90, 0)); Player player = newCharacter.GetComponent <Player>(); player.SetFromPlayerParams(pp); players.Add(pp); playerObjects.Add(newCharacter); }