// Start is called before the first frame update void Start() { playerload = GameObject.Find("PlayerLoader"); parentCharacters = transform.Find("Characters"); settings = new SettingsLevel(moveSpeed, jumpSpeed, gravity, distanceRangerAttack); if (playerload != null) { foreach (Transform child in playerBoardUI) { Destroy(child.gameObject); } int i = 0; foreach (Transform child in playerload.transform) { Vector3 spawnPoint = new Vector3(0, 2.5f, 0); Quaternion rotationPoint = Quaternion.identity; Transform transformSpawnPoint = parentSpawnPointCharacters.GetChild(i); if (transformSpawnPoint != null) { spawnPoint = transformSpawnPoint.position; rotationPoint = transformSpawnPoint.rotation; } StandardController stController = child.GetComponent <StandardController>(); if (stController != null) { GameObject character = stController.StartGame(parentCharacters, spawnPoint, rotationPoint, settings); GameObject scoreUI = Instantiate(prefabPlayerScore, playerBoardUI); PlayerManager pManager = character.GetComponent <PlayerManager>(); pManager.killsNeeded = killsNeeded; PlayerUI uiPlayer = scoreUI.GetComponent <PlayerUI>(); uiPlayer.SetPlayer(pManager); uiPlayer.ShowBells(); } ClientServerConnection phoneConnection = child.GetComponent <ClientServerConnection>(); if (phoneConnection != null) { GameObject character = phoneConnection.StartGame(parentCharacters, spawnPoint, rotationPoint, settings); GameObject scoreUI = Instantiate(prefabPlayerScore, playerBoardUI); PlayerManager pManager = character.GetComponent <PlayerManager>(); pManager.killsNeeded = killsNeeded; PlayerUI uiPlayer = scoreUI.GetComponent <PlayerUI>(); uiPlayer.SetPlayer(pManager); uiPlayer.ShowBells(); } i++; } } // Switch menu clients Server.StartGame(); // Show message StartCoroutine(ShowMessage()); pickups.SearchForPlayers(); if (FadeInOut.screen != null) { FadeInOut.screen.FadeIn(); } }