public void JoinPlayer(string playerId, int position) { GameObject player = GameObject.Instantiate(this.m_RoomPlayerPrefab) as GameObject; player.transform.parent = this.m_Positions[position].transform; player.transform.localPosition = new Vector3(0, 0, -1); LobbyPlayerBehavior pb = player.GetComponent <LobbyPlayerBehavior>(); pb.PlayerId = playerId; pb.Position = position; this.m_Players.Add(playerId, player); }
void Start() { this.m_RoomNo = this.RoomInformation.RoomNo; this.m_NoText.text = this.m_RoomNo.ToString(); this.m_Players = new Dictionary <string, GameObject>(); for (int i = 0; i < this.RoomInformation.Players.Count; i++) { CommandConsts.PlayerInformation playerInfo = this.RoomInformation.Players[i]; GameObject player = GameObject.Instantiate(this.m_RoomPlayerPrefab) as GameObject; int position = playerInfo.Position; player.transform.parent = this.m_Positions[position].transform; player.transform.localPosition = new Vector3(0, 0, -1); LobbyPlayerBehavior pb = player.GetComponent <LobbyPlayerBehavior>(); pb.PlayerId = playerInfo.PlayerId; pb.Position = playerInfo.Position; this.m_Players.Add(playerInfo.PlayerId, player); tk2dSprite sp = player.GetComponentInChildren <tk2dSprite>(); sp.color = playerInfo.IsReady ? Color.red : Color.white; } }