Ejemplo n.º 1
0
        /// <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());
        }
        // Use this for initialization
        protected virtual void Start()
        {
            //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();

            //Setup the avatars
            foreach (MMIAvatar avatar in this.Avatars)
            {
                //Setup the avatar
                avatar.Setup(this.RegisterAddress, this.RegisterPort, this.SessionId);
            }

            //Wait and check if all connections are initialized
            this.StartCoroutine(CheckInitialization());

            //Create a timer
            this.timer = new Timer(TimerCallback, "finished", 0, (int)(this.FixedStepTime * 1000.0f));
        }