Android
Android copied to clipboard
Hsygdh
This issue is drafted for the itheima1/Android repository. Please provide additional context, requirements, or details to help clarify the problem or feature request you would like to address.
BattlegroundGame/ ├── Assets/ │ ├── Scripts/ │ │ └── PlayerController.cs │ │ └── Weapon.cs │ ├── Prefabs/ │ ├── Scenes/ │ │ └── MainScene.unity ├── Multiplayer/ │ └── NetworkManager.cs ├── UI/ │ └── LobbyUI.prefab
using UnityEngine; using Photon.Pun; using Photon.Realtime;
public class Launcher : MonoBehaviourPunCallbacks { public void StartGame() { PhotonNetwork.ConnectUsingSettings(); }
public override void OnConnectedToMaster()
{
PhotonNetwork.JoinOrCreateRoom("BattleRoom", new RoomOptions { MaxPlayers = 20 }, TypedLobby.Default);
}
public override void OnJoinedRoom()
{
// spawn handled by GameManager (it will check OnJoinedRoom as well)
GameManager.Instance.SpawnLocalPlayer();
}
}