/// <summary> /// Method to setup the simulation controller /// </summary> public virtual void Setup() { //Manually update the phsyics Physics.autoSimulation = false; //Specify the target frame rate Application.targetFrameRate = 90; //Creates a new session ID if (this.AutoCreateSessionID) { //Create a new session id this.SessionId = UnitySceneAccess.CreateUUID(); } //Get all avatars this.Avatars = this.GetComponentsInChildren <MMIAvatar>().ToList(); MMISettings settings = this.GetComponent <MMISettings>(); //Setup the avatars foreach (MMIAvatar avatar in this.Avatars) { //Setup the avatar avatar.Setup(settings.MMIRegisterAddress, settings.MMIRegisterPort, this.SessionId); } //Wait and check if all connections are initialized this.StartCoroutine(CheckInitialization()); }
/// <summary> /// Coroutine to check the initialization state /// </summary> /// <returns></returns> protected virtual IEnumerator CheckInitialization() { while (this.Avatars.Exists(s => !s.MMUAccess.IsInitialized || s.CoSimulator == null)) { yield return(null); } Debug.Log("Initialized"); this.initialized = true; this.OnInitialized?.Invoke(this, new EventArgs()); MMISettings settings = this.GetComponent <MMISettings>(); }