Ejemplo n.º 1
0
        /// <summary>
        /// Creates and setup the feature on obj.
        /// </summary>
        /// <param name="obj">The object to spawn and configure the feature.</param>
        public void SetupFeature(GameObject obj)
        {
            // Add component
            obj.AddComponent <ArcTeleportManager>();

            // Secondary scripts
            GameObject navmesh = new GameObject();

            navmesh.name             = "Navmesh";
            navmesh.transform.parent = obj.transform;
            navmesh.AddComponent <BorderRenderer>();
            navmesh.AddComponent <NavMeshRenderer>();
            navmesh.transform.position = Vector3.zero;

            GameObject pointer = new GameObject();

            pointer.name             = "Pointer";
            pointer.transform.parent = obj.transform;
            pointer.AddComponent <ParabolicPointer>();
            pointer.transform.position = Vector3.zero;

            // Setup Component
            ArcTeleportManager teleportManager = obj.GetComponent <ArcTeleportManager>();

            ParabolicPointer pointerComponent = pointer.GetComponent <ParabolicPointer>();

            teleportManager.Pointer = pointerComponent;

            NavMeshRenderer navMeshHandler = navmesh.GetComponent <NavMeshRenderer>();
            BorderRenderer  border         = navmesh.GetComponent <BorderRenderer>();

            NavMeshHelper.ClearNavMesh(navMeshHandler, new SerializedObject(navMeshHandler), TeleportSettings);
            NavMeshHelper.UpdateNavMesh(navMeshHandler, new SerializedObject(navMeshHandler), TeleportSettings);
        }
Ejemplo n.º 2
0
        private IEnumerator Start()
        {
            yield return(null);

            ToggleGosForPreview(true, _gosToHideInPreview);
            ToggleGosForPreview(false, _gosToShowInPreview);

            //If user has checked the "Is Test Scene" checkbox load the current scene
            if (_isTestScene)
            {
                //make sure we have a navmesh
                if (_navMesh == null)
                {
                    _navMesh = FindObjectOfType <ViveNavMesh>();
                    if (_navMesh != null)
                    {
                        _navMeshAnimator = _navMesh.GetComponent <Animator>();

                        ParabolicPointer pointer = FindObjectOfType <ParabolicPointer>();
                        if (pointer != null)
                        {
                            pointer.NavMesh = _navMesh;
                        }

                        TeleportVive teleporter = FindObjectOfType <TeleportVive>();
                        if (teleporter != null)
                        {
                            teleporter.NavAnimator = _navMeshAnimator;
                        }
                    }
                }

                LoadTestScene();
            }
        }
Ejemplo n.º 3
0
    public void AssignPointerMesh()
    {
        if (Pointer == null)
        {
            Pointer = FindObjectOfType <ParabolicPointer> ();
            Debug.Log("I restarted pointer");
        }

        if (NavmeshAnimator == null)
        {
            NavmeshAnimator = FindObjectOfType <ViveNavMesh> ().gameObject.GetComponent <Animator> ();
            Debug.Log("I restarted navanimator");
        }
    }
 // Use this for initialization
 void Start()
 {
     p = this.GetComponent <ParabolicPointer> ();
 }