Open sidebar
using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameManager : Photon.MonoBehaviour { public GameObject[] spawnSpots; public int state = 0; void Connect() { PhotonNetwork.ConnectUsingSettings("V1.0"); } void OnJoinedLobby() { state = 1; } void OnPhotonRandomJoinFailed() { PhotonNetwork.CreateRoom(null); } void OnJoinedRoom() { state = 2; } // Use this for initialization void Start () { } // Update is called once per frame void Update () { } void OnGUI() { switch (state) { case 0: if (GUI.Button(new Rect(10,10,100,30), "Connect")) { Connect(); } break; case 1: GUI.Label(new Rect(10, 10, 100, 30), "Connected"); if (GUI.Button(new Rect(10, 10, 100, 30), "Search")) { PhotonNetwork.JoinRandomRoom(); } break; case 2: GUI.Label(new Rect(10, 10, 100, 30), "Select Your Champion"); if (GUI.Button(new Rect(10, 10, 100, 30), "Barbarian Mage")) { spawnCharacter(0, "Barbarian Mage"); } break; case 3: //IN GAME break; } } void spawnCharacter(int team, string character) { state = 3; Debug.Log("You are on team.... " + team + ". And are playing as " + character); } }
Close sidebar
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting