/// <summary>
        /// Sets the PCF to bind to and the transform to refer to when the PCF updates.
        /// Adds this binding to the passed PCF.
        /// </summary>
        public bool Bind(MLPersistentCoordinateFrames.PCF pcf, Transform transform, bool regain = false)
        {
            bool success = true;

            if (pcf != null)
            {
                this.pcf = pcf;
            }

            if (transform != null)
            {
                this.transform = transform;
            }

            if (regain)
            {
                success &= Regain();
            }

            success &= Update();

            if (success)
            {
                pcf.AddBinding(this);
                MLPersistentCoordinateFrames.QueueForUpdates(pcf);
            }

            return(success);
        }
Exemple #2
0
            /// <summary>
            /// Sets the PCF to bind to and the text mesh to refer to when the PCF updates.
            /// Adds this binding to the passed PCF.
            /// </summary>
            public void Bind(MLPersistentCoordinateFrames.PCF pcf, TextMesh textMesh)
            {
                if (pcf != null)
                {
                    PCF = pcf;
                }

                if (textMesh != null)
                {
                    _textMesh = textMesh;
                }

                if (PCF != null && _textMesh != null)
                {
                    _textMesh = textMesh;
                    PCF       = pcf;
                    PCF.AddBinding(this);
                    MLPersistentCoordinateFrames.QueueForUpdates(pcf);
                    switch (PCF.CurrentStatus)
                    {
                    case MLPersistentCoordinateFrames.PCF.Status.Created:
                    {
                        _textMesh.text = "<color=green>Created</color>\n" + GetPCFStateString();
                        break;
                    }

                    case MLPersistentCoordinateFrames.PCF.Status.Updated:
                    {
                        Update();
                        break;
                    }

                    case MLPersistentCoordinateFrames.PCF.Status.Regained:
                    {
                        Regain();
                        break;
                    }

                    case MLPersistentCoordinateFrames.PCF.Status.Lost:
                    {
                        Lost();
                        break;
                    }
                    }
                }
            }