示例#1
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start()
    {
        // get the reference of mesh
        MeshFilter mf = gameObject.GetComponent <MeshFilter>();

        if (mf == null)
        {
            MeshFilter meshFilter = (MeshFilter)gameObject.AddComponent(typeof(MeshFilter));
            meshFilter.mesh = m_mesh = new Mesh();
            MeshRenderer renderer = gameObject.AddComponent(typeof(MeshRenderer)) as MeshRenderer;
            renderer.material.shader = Shader.Find("Mobile/Unlit (Supports Lightmap)");
        }
        else
        {
            m_mesh = mf.mesh;
        }
        m_isDirty = false;
        _CreateMesh();
        transform.localScale = new Vector3(transform.localScale.x,
                                           transform.localScale.y * -1.0f,
                                           transform.localScale.z);

        m_tangoApplication = FindObjectOfType <TangoApplication>();

        if (m_tangoApplication != null)
        {
            // Request Tango permissions
            m_tangoApplication.RequestNecessaryPermissions();

            if (TangoApplication.HasGrantedPermissions())
            {
                m_tangoApplication.InitApplication();

                if (m_useADF)
                {
                    // Query the full adf list.
                    PoseProvider.RefreshADFList();
                    // loading last recorded ADF
                    string uuid = PoseProvider.GetLatestADFUUID().GetStringDataUUID();
                    m_tangoApplication.InitProviders(uuid);
                }
                else
                {
                    m_tangoApplication.InitProviders(string.Empty);
                }

                m_tangoApplication.ConnectToService();
            }
            else
            {
                UnityEngine.Debug.Log("Tango can't be initialized because of invalid permissions");
            }
        }
        else
        {
            UnityEngine.Debug.Log("No Tango Manager found in scene.");
        }
    }
示例#2
0
    private void Start()
    {
        m_tangoApplication = FindObjectOfType <TangoApplication>();

        if (m_tangoApplication != null)
        {
            // Request Tango permissions
            m_tangoApplication.RequestNecessaryPermissions();

            if (TangoApplication.HasGrantedPermissions())
            {
                m_tangoApplication.InitApplication();

                if (m_useADF)
                {
                    // Query the full adf list.
                    PoseProvider.RefreshADFList();
                    // loading last recorded ADF
                    string uuid = PoseProvider.GetLatestADFUUID().GetStringDataUUID();
                    m_tangoApplication.InitProviders(uuid);
                }
                else
                {
                    m_tangoApplication.InitProviders(string.Empty);
                }

                m_tangoApplication.ConnectToService();
            }
            else
            {
                Debug.Log("Tango can't be initialized because of invalid permissions");
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }

        m_tangoServiceVersionName = TangoApplication.GetTangoServiceVersion();
    }
    private void Start()
    {
        m_tangoApplication = FindObjectOfType <TangoApplication>();

        if (m_tangoApplication != null)
        {
            if (AndroidHelper.IsTangoCorePresent())
            {
                // Request Tango permissions
                m_tangoApplication.RegisterPermissionsCallback(_OnTangoApplicationPermissionsEvent);
                m_tangoApplication.RequestNecessaryPermissions();
                m_tangoServiceVersionName = TangoApplication.GetTangoServiceVersion();
            }
            else
            {
                // If no Tango Core is present let's tell the user to install it!
                StartCoroutine(_InformUserNoTangoCore());
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }
    }