TeamToSwitchTo
How do I use Team To Switch To
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
18 | PhotonNetwork.player.SetTeam(this.TeamToSwitchTo); | 1 |
File name: OnCollideSwitchTeam.cs
Copy
9 public void OnTriggerEnter(Collider other)
10 {
11 // it's ridiculously easy to switch teams. you only have to make sure you do it for your own characters
12 // (this trigger is called on all clients, when a user's character enters the trigger...)
13
14 // find a PhotonView and check if the character "isMine". Only then, set this client's player-team.
15 PhotonView otherPv = other.GetComponent
16 if (otherPv != null && otherPv.isMine)
17 {
18 PhotonNetwork.player.SetTeam(this.TeamToSwitchTo);
19 }
20 }
TeamToSwitchTo 101 lượt xem
Gõ tìm kiếm nhanh...