ShowScores
How do I use Show Scores
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
23 | if (this.ShowScores) | 1 |
File name: PickupDemoGui.cs
Copy
15 public void OnGUI()
16 {
17 if (!PhotonNetwork.inRoom)
18 {
19 return;
20 }
21
22
23 if (this.ShowScores)
24 {
25 GUILayout.Label("Your Score: " + PhotonNetwork.player.GetScore());
26 }
27
28
29 if (this.ShowDropButton)
30 {
31 foreach (PickupItem item in PickupItem.DisabledPickupItems)
32 {
33 if (item.PickupIsMine && item.SecondsBeforeRespawn <= 0)
34 {
35 if (GUILayout.Button("Drop " + item.name))
36 {
37 item.Drop(); // drops the item at the place where it originates
38 }
39
40 GameObject playerCharGo = PhotonNetwork.player.TagObject as GameObject;
41 if (playerCharGo != null && GUILayout.Button("Drop here " + item.name))
42 {
43 // drop the item at some other place. next to the user's character would be fine...
44 Vector3 random = Random.insideUnitSphere;
45 random.y = 0;
46 random = random.normalized;
47 Vector3 itempos = playerCharGo.transform.position + this.DropOffset * random;
48
49 item.Drop(itempos);
50 }
51 }
52 }
53 }
54
55
56 if (this.ShowTeams)
57 {
58 foreach (var teamName in PunTeams.PlayersPerTeam.Keys)
59 {
60 GUILayout.Label("Team: " + teamName.ToString());
61 List
62 foreach (PhotonPlayer player in teamPlayers)
63 {
64 GUILayout.Label(" " + player.ToStringFull() + " Score: " + player.GetScore());
65 }
66 }
67
68 if (GUILayout.Button("to red"))
69 {
70 PhotonNetwork.player.SetTeam(PunTeams.Team.red);
71 }
72 if (GUILayout.Button("to blue"))
73 {
74 PhotonNetwork.player.SetTeam(PunTeams.Team.blue);
75 }
76 }
77 }
ShowScores 126 lượt xem
Gõ tìm kiếm nhanh...