Exemplo n.º 1
0
        static void InstantiateRightControllers(MenuCommand menuCommand)
        {
            // Create a custom game object
            GameObject newController = (GameObject)PrefabUtility.InstantiatePrefab(VRDFPrefabReferencer.GetPrefab("RightControllerModel [DestroyedOnStart]"));

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(newController, menuCommand.context as GameObject);

            // Register the creation in the undo system
            Undo.RegisterCreatedObjectUndo(newController, "Create " + newController.name);
            Selection.activeObject = newController;
        }
        static void InstantiateLeftController(MenuCommand menuCommand)
        {
            _infoToAddToWindow = "This prefab let you see the Left controller of the other users.";
            _window            = CreateWindow <MultiplayerPrefabsInstancier>("Left Controller for Remote Players");
            SetWindowSize();

            // Create a custom game object
            GameObject newMultiObject = (GameObject)PrefabUtility.InstantiatePrefab(VRDFPrefabReferencer.GetPrefab("LeftControllerModelMultiplayer"));

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(newMultiObject, menuCommand.context as GameObject);

            // Register the creation in the undo system
            Undo.RegisterCreatedObjectUndo(newMultiObject, "Create " + newMultiObject.name);
            Selection.activeObject = newMultiObject;
        }
Exemplo n.º 3
0
        static void InstantiateVRCanvas(MenuCommand menuCommand)
        {
            // Create a custom game object
            GameObject newCanvas = (GameObject)PrefabUtility.InstantiatePrefab(VRDFPrefabReferencer.GetPrefab("VRCanvas"));

            RectTransform rt = newCanvas.GetComponent <RectTransform>();

            rt.localPosition = Vector3.zero;
            rt.localScale    = new Vector3(0.012f, 0.012f, 0.012f);

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(newCanvas, menuCommand.context as GameObject);

            // Register the creation in the undo system
            Undo.RegisterCreatedObjectUndo(newCanvas, "Create " + newCanvas.name);
            Selection.activeObject = newCanvas;
        }
        static void InstantiateSharedLaserPointer(MenuCommand menuCommand)
        {
            // Create a custom game object
            GameObject newMultiObject = (GameObject)PrefabUtility.InstantiatePrefab(VRDFPrefabReferencer.GetPrefab("LaserPointerMultiplayer"));

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(newMultiObject, menuCommand.context as GameObject);

            // Register the creation in the undo system
            Undo.RegisterCreatedObjectUndo(newMultiObject, "Create " + newMultiObject.name);
            Selection.activeObject = newMultiObject;

            _infoToAddToWindow = "This prefab let you see the laser pointer of the remote users. TO use this feature,\n" +
                                 "you need to add a Laser Pointer (Hierarchy>VRDF>Raycast>Add Raycaster with Laser Pointer) for the local user in your scene or SetupVR prefab.";
            _window = CreateWindow <MultiplayerPrefabsInstancier>("Laser for Remote Players");
            SetWindowSize();
        }
Exemplo n.º 5
0
        static void InstantiateVRButton(MenuCommand menuCommand)
        {
            // Create a custom game object
            GameObject newButton = (GameObject)PrefabUtility.InstantiatePrefab(VRDFPrefabReferencer.GetPrefab("VRButton"));

            RectTransform rt = newButton.GetComponent <RectTransform>();

            rt.localPosition = new Vector3(rt.rect.x, rt.rect.y, 0);
            rt.localScale    = Vector3.one;

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(newButton, menuCommand.context as GameObject);

            // Register the creation in the undo system
            Undo.RegisterCreatedObjectUndo(newButton, "Create " + newButton.name);
            Selection.activeObject = newButton;

            Core.Raycast.VRRaycastAuthoring.CheckSceneContainsRaycaster();
        }
        static void InstantiateGameManager(MenuCommand menuCommand)
        {
            var connectionManager = FindObjectOfType <VRDFMultiplayerGameManager>();

            if (connectionManager != null)
            {
                VRDF_Components.DebugVRDFMessage("A VRDFMultiplayerGameManager script is already in your scene, no need for a second one !", true);
                Selection.activeObject = connectionManager;
                return;
            }

            // Create a custom game object
            GameObject newMultiObject = (GameObject)PrefabUtility.InstantiatePrefab(VRDFPrefabReferencer.GetPrefab("VRDFMultiplayerGameManager"));

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(newMultiObject, menuCommand.context as GameObject);

            // Register the creation in the undo system
            Undo.RegisterCreatedObjectUndo(newMultiObject, "Create " + newMultiObject.name);
            Selection.activeObject = newMultiObject;
        }
        private static void AddCurveTeleporter(MenuCommand menuCommand)
        {
            var curveTeleporter = VRDFPrefabReferencer.GetPrefab("CurveTeleporter");

            CreateGameObject(curveTeleporter, menuCommand);
        }
        private static void AddStepByStepTeleporter(MenuCommand menuCommand)
        {
            var sbsTeleporter = VRDFPrefabReferencer.GetPrefab("StepByStepTeleporter");

            CreateGameObject(sbsTeleporter, menuCommand);
        }