public void setupGame(int playerChoice) { Debug.Log(PhotonNetwork.LocalPlayer.NickName + " " + PhotonNetwork.LocalPlayer.CustomProperties["TeamNum"]); Debug.Log("Setup for " + playerChoice); // TEMPORARY if (!PhotonNetwork.IsConnected) { for (int i = 0; i < 6; i++) { if (i == playerChoice) { teamTypes[i] = Team.Type.player; } else { teamTypes[i] = Team.Type.ai; } } } createTeams(); if (PhotonNetwork.IsConnected) { GameObject.Find("OverlayCanvas/UISidePanel/UIShipControl/GoButton/GoText").GetComponent <Text>().text = "Click to Ready Up"; for (int i = 0; i < teamTypes.Length; i++) { switch (teamTypes[i]) { case (Team.Type) 2: Debug.Log("Team " + teams[i].TeamFaction + " is off"); teams[i].setTeamType((Team.Type) 2); break; case (Team.Type) 1: Debug.Log("Team " + teams[i].TeamFaction + " is human"); teams[i].setTeamType((Team.Type) 1); break; case (Team.Type) 0: default: Debug.Log("Team " + teams[i].TeamFaction + " is ai"); teams[i].setTeamType((Team.Type) 0); break; } foreach (Player p in PhotonNetwork.PlayerList) { if ((int)p.CustomProperties["TeamNum"] == i) { GameObject.Find("OverlayCanvas/UIBottomPanel/Player" + (i + 1) + "Text").GetComponent <Text>().text = p.NickName; } } } foreach (Team t in teams) { if (t.TeamType == (Team.Type) 1) { t.aiTeam = false; } } } if (PhotonNetwork.IsMasterClient) { foreach (Team t in teams) { if (t.TeamType == (Team.Type) 0) { PhotonView.Get(this).RPC("SetDefaultAITextColor", RpcTarget.All, ((int)t.TeamFaction + 1)); } } } playerFaction = (Team.Faction)playerChoice; playerTeam = teams[(int)playerFaction]; Debug.Log("My playerFaction is " + playerFaction.ToString()); Debug.Log("My team is " + playerTeam.TeamFaction.ToString()); //if (PhotonNetwork.IsConnected) // PhotonView.Get(this).RPC("teamIsHuman",RpcTarget.All,playerChoice); if (playerTeam == null) { Debug.LogError("Player's team is null"); } createPorts(); if (playerTeam == null) { Debug.LogError("Player's team is null"); } createShips(); if (!PhotonNetwork.IsConnected || (PhotonNetwork.IsConnected && PhotonNetwork.IsMasterClient)) { assignAI(); setAIDirections(); uiControl.PostTeamSelection(); } if (!PhotonNetwork.IsConnected) { SetPortTransparency(); SetInitialRedirects(); RevealRedirects(); } if (PhotonNetwork.IsConnected) { ExitGames.Client.Photon.Hashtable ht = PhotonNetwork.LocalPlayer.CustomProperties; ht["LoadedGame"] = true; PhotonNetwork.LocalPlayer.SetCustomProperties(ht); } cameraLock = false; GameObject.Find("TeamIcon").GetComponent <Image>().sprite = playerTeam.getPortSprite(); }
/// <summary> /// Returns a string version of the teamtype for this team. /// </summary> /// <returns>the string version of the teamtype for this team.</returns> public override string ToString() { return(teamFaction.ToString()); }