private PlayerCreationEntity GetPlayerCreationEntityByName(string playerName) { foreach (Transform child in WebGamePlayersContainer.transform) { PlayersContainerScript playersContainerScript = child.GetComponent <PlayersContainerScript>(); var ent = playersContainerScript.GetPlayerCreationEntity(); if (ent.PlayerName.Equals(playerName)) { return(ent); } } return(null); }
private void WebGameCleanPlayersList() { foreach (Transform child in WebGamePlayersContainer.transform) { PlayersContainerScript playersContainerScript = child.GetComponent <PlayersContainerScript>(); Color color; if (playersContainerScript.TryGetColor(out color)) { _playerColorsHelper.PutColorBack(color); } Destroy(child.gameObject); } }
private void StartGame(GameObject playersContainer) { ApplicationModel.ResetMatch(); ApplicationModel.PlayersToCreate.Clear(); foreach (Transform child in playersContainer.transform) { PlayersContainerScript container = child.GetComponent <PlayersContainerScript>(); if (container != null) { ApplicationModel.PlayersToCreate.Add(container.GetPlayerCreationEntity()); } } }
private List <Color> GetPlayersColors() { var colors = new List <Color>(); foreach (Transform child in WebGamePlayersContainer.transform) { PlayersContainerScript playersContainerScript = child.GetComponent <PlayersContainerScript>(); if (playersContainerScript.Type.In(PlayerType.LocalPlayer, PlayerType.RemotePlayer)) { Color color; if (playersContainerScript.TryGetColor(out color)) { colors.Add(color); } } } return(colors); }