public IEnumerator WorldTestWithEnumeratorPasses() { UnityEngine.SceneManagement.SceneManager.LoadScene("MainScene"); yield return(null); NetSystem NetSys = GameObject.FindObjectOfType <NetSystem>(); Assert.NotNull(NetSys); PlayerClient PC = GameObject.FindObjectOfType <PlayerClient>(); Assert.NotNull(PC); MultiMenu MM = GameObject.FindObjectOfType <MultiMenu>(); Assert.NotNull(MM); Assert.AreSame(NetSys, MM.NetSystem, "MultiMenu and the Scene have Diffrent NetSystems"); yield return(null); MM.HostGame(); Color PlayerColor = Random.ColorHSV(); Debug.Log($"Random Color Selected: {PlayerColor}"); PC.CP.C = PlayerColor; yield return(new WaitUntil(() => MM.NetSystem.isNetworkActive)); Assert.AreEqual(PlayerColor, PC.NP.Color); Assert.AreEqual(PlayerColor, PC.PB.Body.GetComponent <SpriteRenderer>().color); yield return(new WaitForSeconds(10)); Assert.Less(PC.PB.Body.rb.velocity.magnitude, .01f, "The player was moving after one second with no interaction"); }
public static void CreateRoom() { RoomOptions options = new RoomOptions() { MaxPlayers = 4, IsOpen = true, IsVisible = true }; PhotonNetwork.CreateRoom(instance.RoomName.text, options, TypedLobby.Default); MultiMenu.SetPlayerName(instance.UserName.text); }
// Use this for initialization public void Start() { Time.timeScale = 1.0f; mainMenuAnim = mainMenu.GetComponent <Animator>(); weaponsMenuAnim = weaponsMenu.GetComponent <Animator>(); graphismeMenuAnim = graphismeMenu.GetComponent <Animator>(); languageMenuAnim = languageMenu.GetComponent <Animator>(); MultiMenuAnim = MultiMenu.GetComponent <Animator>(); controlsMenuAnim = controlsMenu.GetComponent <Animator>(); //backgroundAnim = background.GetComponent<Animator>(); StartMenuAnim = StartMenu.GetComponent <Animator>(); }
/// <summary> /// Gets the command from menu. /// </summary> /// <returns></returns> private string GetCommandFromMenu() { try { // open multiplayer window MultiMenuModel model = new MultiMenuModel(); MultiMenuVM vm = new MultiMenuVM(model); MultiMenu mnu = new MultiMenu(vm); string cmd; mnu.ShowDialog(out cmd); return(cmd); } catch (Exception e) { MessageBox.Show("Error connecting to the server!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return(null); } }
private void Awake() { _instance = this; }