Example #1
0
 public AbstractHanger(bool _isUsable, OVRPlayerController _player)
 {
     isUsable = _isUsable;
     player   = _player;
     CreateModel();
     HidePrefab();
 }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("VR enabled: " + XRDevice.isPresent);
        XRSettings.enabled = XRDevice.isPresent;

        if (false == XRDevice.isPresent)
        {
            // Enable cursor if no vr device is connected
            // Otherwise the user couldn't click on our fancy HUD menu :)
            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.None;
        }
        else
        {
            Debug.Log("deactivate mosue");
            Transform           player     = GameObject.Find("OVRPlayerController").transform;
            OVRPlayerController controller = (OVRPlayerController)player.GetComponent("OVRPlayerController");
            controller.SetSkipMouseRotation(true);
        }

        // disable hands if no VR device connected (else we get spammed with error messages)
        vrHands.SetActive(XRDevice.isPresent);
        if (false == XRDevice.isPresent)
        {
            GameObject avatarMng = GameObject.Find("OvrAvatarSDKManager");
            if (null != avatarMng)
            {
                avatarMng.SetActive(false);
            }
        }

        configureVRControlability();
    }
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         OVRPlayerController Acceleration = gameObject.GetComponent <OVRPlayerController>();
     }
 }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Awake()
        {
            RandomUtil.Init(RandomSeed);

            vCubesObj = new GameObject("Cubes");
            vCubesObj.transform.SetParent(gameObject.transform, false);

            vLight     = GameObject.Find("Light").GetComponent <Light>();
            vSpotlight = GameObject.Find("Spotlight").GetComponent <Light>();
            vEnviro    = GameObject.Find("DemoEnvironment");

            for (int i = 0; i < Count; ++i)
            {
                BuildCube(i);
            }

            vSpotlight.enabled = false;

            ////

            GameObject ovrObj = GameObject.Find("LeapOVRPlayerController");

            if (ovrObj != null)
            {
                OVRPlayerController ovrPlayer = ovrObj.GetComponent <OVRPlayerController>();
                ovrPlayer.SetSkipMouseRotation(true);
            }
        }
Example #5
0
    void OnEnable()
    {
        GameObject            go  = GameObject.FindGameObjectWithTag("Player") as GameObject;
        FirstPersonController fpc = go.GetComponent <FirstPersonController>();

        if (fpc)
        {
            // normal mode
            walkspeed       = fpc.m_WalkSpeed;
            fpc.m_WalkSpeed = 0;
        }

        OVRPlayerController ovr = go.GetComponent <OVRPlayerController>();

        if (ovr)
        {
            // VR mode
            ovr.enabled = false;
        }

        // enable functional
        Collider[] colls = gameObject.GetComponentsInChildren <Collider>();
        foreach (Collider col in colls)
        {
            col.enabled = true;
        }

        // in case in the VR mode, user lost the focus.
        emailAddress.text         = "";
        emailAddress.interactable = true;
        emailAddress.ActivateInputField();
    }
Example #6
0
    public override void activate()
    {
        ovrGamepadController = GetComponent <OVRGamepadController>();
        ovrPlayerController  = GetComponent <OVRPlayerController>();

        if (ovrPlayerController == null)
        {
            CLogger.LogError("Fallback to COVRPlayerControllerCoupled failed. Missing OVRGamepadController component.");
            return;
        }
        else
        {
            //Enable OVRPlayerController to support keyboard movement
            ovrPlayerController.enabled = true;
        }

        if (ovrGamepadController == null)
        {
            CLogger.LogWarning("COVRPlayerControllerCoupled is missing OVRGamepadController component.");
        }
        else
        {
            //Enable OVRGamepadController to support gamepad movement
            ovrGamepadController.enabled = true;
        }
    }
        void Start()
        {
            characterController = GetComponentInChildren <CharacterController>();

            pControl = GetComponentInChildren <OVRPlayerController>();
            _initialGravityModifier = pControl.GravityModifier;

            _initialPosition = characterController.transform.position;
            float initialY = _initialPosition.y;

            if (initialY < MinElevation)
            {
                Debug.LogWarning("Initial Starting Position is lower than Minimum Elevation. Increasing Min Elevation to " + MinElevation);
                MinElevation = initialY;
            }
            if (initialY > MaxElevation)
            {
                Debug.LogWarning("Initial Starting Position is greater than Maximum Elevation. Reducing Max Elevation to " + MaxElevation);
                MaxElevation = initialY;
            }

            teleport = GetComponent <PlayerTeleport>();

            climbers = new List <Grabber>();

            ChangeLocomotionType(selectedLocomotion);
        }
Example #8
0
	// * * * * * * * * * * * * *

	// Awake
	void Awake()
	{
		// Find camera controller
		OVRCameraController[] CameraControllers;
		CameraControllers = gameObject.GetComponentsInChildren<OVRCameraController>();
		
		if(CameraControllers.Length == 0)
			Debug.LogWarning("OVRMainMenu: No OVRCameraController attached.");
		else if (CameraControllers.Length > 1)
			Debug.LogWarning("OVRMainMenu: More then 1 OVRCameraController attached.");
		else
			CameraController = CameraControllers[0];
	
		// Find player controller
		OVRPlayerController[] PlayerControllers;
		PlayerControllers = gameObject.GetComponentsInChildren<OVRPlayerController>();
		
		if(PlayerControllers.Length == 0)
			Debug.LogWarning("OVRMainMenu: No OVRPlayerController attached.");
		else if (PlayerControllers.Length > 1)
			Debug.LogWarning("OVRMainMenu: More then 1 OVRPlayerController attached.");
		else
			PlayerController = PlayerControllers[0];
	
	}
    void Start()
    {
        ctrl = GameObject.FindObjectOfType <OVRPlayerController>();

        initial = transform.localScale;
        mini    = new Vector3(initial.x / 33, initial.y, initial.z / 33);
    }
Example #10
0
        protected virtual void Awake()
        {
            oen = GameObject.Find("GlobalControl").GetComponent <OpenvibeEventNotifier>();
            VRTK_SDKManager.instance.AddBehaviourToToggleOnLoadedSetupChange(this);

            PlayerController = GameObject.Find("OVRPlayerController").GetComponent <OVRPlayerController>();
        }
Example #11
0
    /// <summary>
    /// Awake this instance.
    /// </summary>
    void Awake()
    {
        // Find camera controller
        OVRCameraRig[] cameraControllers;
        cameraControllers = gameObject.GetComponentsInChildren <OVRCameraRig>();

        if (cameraControllers.Length == 0)
        {
            Debug.LogWarning("OVRMainMenu: No OVRCameraRig attached.");
        }
        else
        {
            cameraController = cameraControllers[0];
        }

        // Find player controller
        OVRPlayerController[] playerControllers;
        playerControllers = gameObject.GetComponentsInChildren <OVRPlayerController>();

        if (playerControllers.Length == 0)
        {
            Debug.LogWarning("OVRMainMenu: No OVRPlayerController attached.");
        }
        else if (playerControllers.Length > 1)
        {
            Debug.LogWarning("OVRMainMenu: More then 1 OVRPlayerController attached.");
        }
        else
        {
            playerController = playerControllers[0];
        }
    }
Example #12
0
 void Awake()
 {
     character        = GetComponent <CharacterController>();
     playerController = GetComponent <OVRPlayerController>();
     cameraRig        = GetComponentInChildren <OVRCameraRig>();
     bngController    = transform.parent.GetComponent <BNGPlayerController>();
 }
Example #13
0
    private void InitializePlayerReferences()
    {
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        playerController = player.GetComponent <OVRPlayerController>();
        firingSystem     = player.GetComponent <FiringSystem>();
    }
    // Use this for initialization
    void Start()
    {
        anim       = GetComponent <Animator>();
        Player     = GameObject.Find("OVRPlayerController");
        leftArm    = GameObject.Find("Left_Fist");
        rightArm   = GameObject.Find("Right_Fist");
        enemy      = GameObject.Find("Enemy Mech");
        hitEffect  = GameObject.Find("HitPunch");
        hitClone   = GameObject.Find("HitPunch(Clone");
        ultEffectR = GameObject.Find("UltPunchR");
        ultEffectL = GameObject.Find("UltPunchL");
        ultHitboxF = GameObject.Find("UltHitboxF");
        ultHitboxB = GameObject.Find("UltHitboxB");
        ultHitboxR = GameObject.Find("UltHitboxR");
        ultHitboxL = GameObject.Find("UltHitboxL");

        enemyAnim    = enemy.GetComponent <Animator>();
        armR         = rightArm.GetComponent <Collider>();
        armL         = leftArm.GetComponent <Collider>();
        sparks       = hitEffect.GetComponent <ParticleSystem>();
        ultSparkR    = ultEffectR.GetComponent <ParticleSystem>();
        ultSparkL    = ultEffectL.GetComponent <ParticleSystem>();
        playerScript = Player.GetComponent <OVRPlayerController>();
        enemyHealth  = enemy.GetComponent <EnemyHealth>();
        punchSoundL  = leftArm.GetComponent <AudioSource>();
        punchSoundR  = rightArm.GetComponent <AudioSource>();


        effect    = false;
        ultPunchL = true;
        ultPunchR = true;
        Physics.IgnoreLayerCollision(11, 9, true);
        StartCoroutine("TurnOffControlInstructions");
    }
Example #15
0
 // Use this for initialization
 void Start()
 {
     coins            = 0;
     currentItemIndex = 0;
     inventory.Add(emptyItem);
     ovrpc     = GameObject.Find("OVRPlayerVLR").GetComponent <OVRPlayerController>();
     centerEye = GameObject.Find("OVRPlayerVLR/OVRCameraRig/TrackingSpace/CenterEyeAnchor");
 }
 // Start is called before the first frame update
 void Start()
 {
     animator            = GetComponent <Animator>();
     OVRPlayerController = GameObject.FindObjectOfType <OVRPlayerController>();
     controlEscenarios   = GameObject.FindObjectOfType <controlEscenarios>();
     textoStart.text     = "";
     audioSource         = GetComponent <AudioSource>();
 }
Example #17
0
    //[SerializeField]
    //public GameObject highScoretxt;
    //public int highScore;
    //public int score;
    void Start()
    {
        controller = GetComponent <OVRPlayerController>();
        controller.SetMoveScaleMultiplier(moveSpeedMultiplier);

        moveForward        = new Vector3(transform.position.x, transform.position.y, transform.position.z + Zincrement);
        transform.position = Vector3.MoveTowards(transform.position, moveForward, speed * Time.deltaTime);
    }
Example #18
0
 // Start is called before the first frame update
 void Start()
 {
     pControl                = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <OVRPlayerController>();
     characterController     = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <CharacterController>();
     bngController           = GameObject.FindGameObjectWithTag("Player").GetComponent <BNGPlayerController>();
     _initialGravityModifier = pControl.GravityModifier;
     audioSource             = GetComponent <AudioSource>();
 }
Example #19
0
    //public bool isGrounded = true;
    //public float JumpForce = 0.10f;
    // Start is called before the first frame update
    void Start()
    {
        RenderSettings.fog = false;

        //cc = GetComponent<CharacterController>();
        oc = GetComponent <OVRPlayerController>();
        //cm = GetComponent<CharacterMotor>();
    }
Example #20
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         Player   = other.gameObject.GetComponent <OVRPlayerController>();
         Rotation = Player.gameObject.transform.rotation;
         active   = true;
     }
 }
    // Use this for initialization
    void Start()
    {
        OVRPlayerController playerController = FindObjectOfType <OVRPlayerController>();

        if (playerController)
        {
            playerController.SetSkipMouseRotation(true);
        }
    }
Example #22
0
        private void Start()
        {
            playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <OVRPlayerController>();
            character        = GameObject.FindGameObjectWithTag("Player").GetComponent <Character>();

            itemMenu.gameObject.SetActive(false);

            items = GetItemTemplates();
        }
Example #23
0
 StateData(OVRPlayerController OVRPlayer, OVRInput.Controller hand, OVRInput.Controller hand2, Grabber grabber, PocketInventoryManager pocketInventory, CanvasInventoryManager canvasInventory, FileBrowserMenu fileBrowser)
 {
     this.OVRPlayer       = OVRPlayer;
     this.hand            = hand;
     this.hand2           = hand2;
     this.grabber         = grabber;
     this.pocketInventory = pocketInventory;
     this.canvasInventory = canvasInventory;
     this.fileBrowser     = fileBrowser;
 }
Example #24
0
    public void ReorientAvatar()
    {
        if (player == null)
        {
            player = GameObject.Find("OVRPlayerController");
        }

        if (Head == null && player != null)
        {
            Head = DeepChildSearch(player, "head_JNT");
        }

        if (RemoteHead == null)
        {
            RemoteHead = DeepChildSearch(this.transform.parent.gameObject, "head_JNT");
        }

        if (Head != null && player != null)
        {
            Vector3 target = GetAveragePoint();

            //initialize Teleportation
            ovrpc         = player.GetComponent <OVRPlayerController>();
            ovrpc.enabled = false; //disable ovrpc

            //get distance of remote avatar from circle
            Vector3 translateVector = target - player.transform.position;
            translateVector            = new Vector3(translateVector.x, 0f, translateVector.z); //make translation to xz plane
            translateVector            = translateVector.normalized * 1.5f;                     //set ditsance to 1.5 m
            player.transform.position += translateVector;                                       //translate

            //check that remote player and player are not too close
            if (RemoteHead != null)
            {
                Vector3 distanceBetweenPlayers = Head.position - RemoteHead.position;

                if (distanceBetweenPlayers.magnitude < 1f)
                {
                    player.transform.position += (distanceBetweenPlayers.normalized * (1f - distanceBetweenPlayers.magnitude));
                }
            }

            //rotate
            Vector3 localTarget = Head.InverseTransformPoint(target);
            float   angle       = Mathf.Atan2(localTarget.x, localTarget.z) * Mathf.Rad2Deg;
            player.transform.RotateAround(Head.position, Vector3.up, angle);

            ///todo send rotation and translation to remote player

            object[] data = new object[] { angle, PhotonNetwork.NickName };
            PhotonNetwork.RaiseEvent(MasterManager.GameSettings.Reorient, data, Photon.Realtime.RaiseEventOptions.Default, ExitGames.Client.Photon.SendOptions.SendReliable);

            renable = true;
        }
    }
Example #25
0
    private IEnumerator BeginGame()
    {
        mazeInstance = Instantiate(mazePrefab) as Maze;
        yield return(StartCoroutine(mazeInstance.Generate()));

        SpawnHorror(30);
        playerInstance = Instantiate(playerPrefab) as OVRPlayerController;
        playerInstance.SetLocation(mazeInstance.GetCell(new IntVector2(0, 19)));
        trophyInstance = Instantiate(trophyPrefab) as Trophy;
        trophyInstance.SetLocation(mazeInstance.GetCell(new IntVector2(19, 0)));
    }
Example #26
0
    // Use this for initialization
    void Start()
    {
        Physics.gravity = new Vector3(0, -160, 0);

        player = GameObject.FindObjectOfType <OVRPlayerController> ();
        line   = GameObject.Find("Line");

        barSize         = MAX_BAR_POSITION - MIN_BAR_POSITION;
        timeLeft        = GAME_TIME;
        TimeBoard.color = Color.green;
    }
Example #27
0
    /// <summary>
    /// Resets the orientation.
    /// </summary>
    /// <returns><c>true</c>, if orientation was reset, <c>false</c> otherwise.</returns>
    public static bool ResetOrientation()
    {
#if (UNITY_ANDROID && !UNITY_EDITOR)
        // NOTE: Apps that have joystick/separate yaw control will also need to reset their values.
        OVRPlayerController playerController = theDevice.GetComponentInParent <OVRPlayerController>();
        if (playerController != null)
        {
            playerController.ResetOrientation();
        }
#endif
        return(OVR_ResetSensorOrientation());
    }
Example #28
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Awake()
        {
            RandomUtil.Init(RandomSeed);

            vCubesObj = new GameObject("Cubes");
            vCubesObj.transform.SetParent(gameObject.transform, false);

            vLight     = GameObject.Find("Light").GetComponent <Light>();
            vSpotlight = GameObject.Find("Spotlight").GetComponent <Light>();
            vEnviro    = GameObject.Find("DemoEnvironment");

//			for ( int i = 0 ; i < Count ; ++i ) {
//				BuildCube(i);
//			}

            vSpotlight.enabled = false;

            ////

            GameObject ovrObj = GameObject.Find("LeapOVRPlayerController");

            if (ovrObj != null)
            {
                OVRPlayerController ovrPlayer = ovrObj.GetComponent <OVRPlayerController>();
                ovrPlayer.SetSkipMouseRotation(true);
            }

            vCameraMap = new Dictionary <CameraPlacement, Vector3> {
                { CameraPlacement.Sun, planets[0].transform.position },
                { CameraPlacement.Mercury, planets[1].transform.position },
                { CameraPlacement.Venus, planets[2].transform.position },
                { CameraPlacement.Earth, planets[3].transform.position },
                { CameraPlacement.Mars, planets[4].transform.position },
                { CameraPlacement.Jupiter, planets[5].transform.position },
                { CameraPlacement.Saturn, planets[6].transform.position },
                { CameraPlacement.Uranus, planets[7].transform.position },
                { CameraPlacement.Neptune, planets[8].transform.position },
                { CameraPlacement.Pluto, planets[9].transform.position }
            };

            vCameraRotMap = new Dictionary <CameraPlacement, Quaternion> {
                { CameraPlacement.Sun, Quaternion.identity },
                { CameraPlacement.Mercury, Quaternion.identity },
                { CameraPlacement.Venus, Quaternion.identity },
                { CameraPlacement.Earth, Quaternion.identity },
                { CameraPlacement.Mars, Quaternion.identity },
                { CameraPlacement.Jupiter, Quaternion.identity },
                { CameraPlacement.Saturn, Quaternion.identity },
                { CameraPlacement.Uranus, Quaternion.identity },
                { CameraPlacement.Neptune, Quaternion.identity },
                { CameraPlacement.Pluto, Quaternion.identity }
            };
        }
    void Awake()
    {
        iTween.CameraFadeAdd(); // add a camera fade texture

        // TURN OFF OVR CHARACTER STUFF
        OVRCharacter         = Player_OVRPC.GetComponent <CharacterController>();
        OVRGamepad           = Player_OVRPC.GetComponent <OVRGamepadController>();
        OVRPlayer            = Player_OVRPC.GetComponent <OVRPlayerController>();
        OVRCharacter.enabled = false;
        OVRGamepad.enabled   = false;
        OVRPlayer.enabled    = false;
    }
Example #30
0
 void Start()
 {
     if (CharacterController == null)
     {
         CharacterController = GetComponentInParent <CharacterController>();
     }
     Assert.IsNotNull(CharacterController);
     if (PlayerController == null)
     {
         PlayerController = GetComponentInParent <OVRPlayerController>();
     }
     Assert.IsNotNull(PlayerController);
 }
Example #31
0
    public void Start()
    {
        CurrentState = PlayerState.Normal;
        _changingState = false;

        _manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();

        _terrainCollider = GameObject.FindGameObjectWithTag("Terrain").GetComponent<TerrainCollider>();
        _sunLight = GameObject.FindGameObjectWithTag("SunLight").GetComponent<Light>();
        _startIntensity = _sunLight.intensity;
        _ovrPlayerController = GetComponent<OVRPlayerController>();
        _ovrCameraController = GetComponentInChildren<OVRCameraController>();

        _audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManager>();
    }
Example #32
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false;
        gameOverPanel.SetActive(false);
        pausePanel.SetActive(false);
        OverviewCamera.enabled = false;
        redDot.enabled = false;

        Time.timeScale = 1f;

        GameObject gameControllerObject = GameObject.FindWithTag("OVRPlayerController");
        if (gameControllerObject != null)
        {
            player = gameControllerObject.GetComponent<OVRPlayerController>();
        }
        if (player == null)
        {
            Debug.Log("Cannot find 'OVRPlayerController' script");
        }
    }
    /// <summary>
    /// Awake this instance.
    /// </summary>
    void Awake()
    {
        // Find camera controller
        OVRCameraRig[] cameraControllers;
        cameraControllers = gameObject.GetComponentsInChildren<OVRCameraRig>();

        if (cameraControllers.Length == 0)
        {
            Debug.LogWarning("OVRMainMenu: No OVRCameraRig attached.");
        }
        else if (cameraControllers.Length > 1)
        {
            Debug.LogWarning("OVRMainMenu: More then 1 OVRCameraRig attached.");
        }
        else
        {
            cameraController = cameraControllers[0];
        }

        // Find player controller
        OVRPlayerController[] playerControllers;
        playerControllers = gameObject.GetComponentsInChildren<OVRPlayerController>();

        if (playerControllers.Length == 0)
        {
            Debug.LogWarning("OVRMainMenu: No OVRPlayerController attached.");
        }
        else if (playerControllers.Length > 1)
        {
            Debug.LogWarning("OVRMainMenu: More then 1 OVRPlayerController attached.");
        }
        else
        {
            playerController = playerControllers[0];
        }
    }
	// OnEnable
	void OnEnable()
	{
		m_Component = (OVRPlayerController)target;
	}
Example #35
0
 void Awake()
 {
     iTween.CameraFadeAdd(); // add a camera fade texture
     
     // TURN OFF OVR CHARACTER STUFF
     OVRCharacter = Player_OVRPC.GetComponent<CharacterController>();        
     OVRGamepad = Player_OVRPC.GetComponent<OVRGamepadController>();        
     OVRPlayer = Player_OVRPC.GetComponent<OVRPlayerController>();
     OVRCharacter.enabled = false;
     OVRGamepad.enabled = false;
     OVRPlayer.enabled = false;
 }
Example #36
0
    /// <summary>
    /// Awake this instance.
    /// </summary>
    void Awake()
    {
        // Find camera controller
        OVRCameraRig[] CameraControllers;
        CameraControllers = gameObject.GetComponentsInChildren<OVRCameraRig>();

        if(CameraControllers.Length == 0)
            Debug.LogWarning("OVRMainMenu: No OVRCameraRig attached.");
        else if (CameraControllers.Length > 1)
            Debug.LogWarning("OVRMainMenu: More then 1 OVRCameraRig attached.");
        else{
            CameraController = CameraControllers[0];
        #if USE_NEW_GUI
            OVRUGUI.CameraController = CameraController;
        #endif
        }

        // Find player controller
        OVRPlayerController[] PlayerControllers;
        PlayerControllers = gameObject.GetComponentsInChildren<OVRPlayerController>();

        if(PlayerControllers.Length == 0)
            Debug.LogWarning("OVRMainMenu: No OVRPlayerController attached.");
        else if (PlayerControllers.Length > 1)
            Debug.LogWarning("OVRMainMenu: More then 1 OVRPlayerController attached.");
        else{
            PlayerController = PlayerControllers[0];
        #if USE_NEW_GUI
            OVRUGUI.PlayerController = PlayerController;
        #endif
        }

        #if USE_NEW_GUI
            // Create canvas for using new GUI
            NewGUIObject = new GameObject();
            NewGUIObject.name = "OVRGUIMain";
            NewGUIObject.transform.parent = GameObject.Find("LeftEyeAnchor").transform;
            RectTransform r = NewGUIObject.AddComponent<RectTransform>();
            r.sizeDelta = new Vector2(100f, 100f);
            r.localScale = new Vector3(0.001f, 0.001f, 0.001f);
            r.localPosition = new Vector3(0.01f, 0.17f, 0.53f);
            r.localEulerAngles = Vector3.zero;

            Canvas c = NewGUIObject.AddComponent<Canvas>();
            c.renderMode = RenderMode.World;
            c.pixelPerfect = false;
        #endif
    }
Example #37
0
 // Use this for initialization
 void Start()
 {
     playerScript = Player.GetComponent<OVRPlayerController>();
     timeScript = TimeControl.GetComponent<Timer>();
 }
Example #38
0
    // * * * * * * * * * * * * *
    // Awake
    void Awake()
    {
        // Find camera controller
        OVRCameraController[] CameraControllers;
        CameraControllers = gameObject.GetComponentsInChildren<OVRCameraController>();

        if(CameraControllers.Length == 0)
            Debug.LogWarning("OVRMainMenu: No OVRCameraController attached.");
        else if (CameraControllers.Length > 1)
            Debug.LogWarning("OVRMainMenu: More then 1 OVRCameraController attached.");
        else
            CameraController = CameraControllers[0];

        // Find player controller
        OVRPlayerController[] PlayerControllers;
        PlayerControllers = gameObject.GetComponentsInChildren<OVRPlayerController>();

        if(PlayerControllers.Length == 0)
            Debug.LogWarning("OVRMainMenu: No OVRPlayerController attached.");
        else if (CameraControllers.Length > 1)
            Debug.LogWarning("OVRMaunMenu: More then 1 OVRPlayerController attached.");
        else
            PlayerController = PlayerControllers[0];

        // Set the GUI target
        GUIRenderObject = GameObject.Instantiate(Resources.Load("OVRGUIObjectMain")) as GameObject;

        if(GUIRenderObject != null)
        {
            if(GUIRenderTexture == null)
            {
                int w = (int)(Screen.width);
                int h = (int)(Screen.height);
                GUIRenderTexture = new RenderTexture(  w, h, 24);

                GuiHelper.Draw3D = true;
            }
        }
    }
Example #39
0
 /// <summary>
 /// Sets the OVR player controller.
 /// </summary>
 /// <param name="playerController">Player controller.</param>
 public void SetOVRPlayerController(ref OVRPlayerController playerController)
 {
     PlayerController = playerController;
 }
        // Use this for initialization
        void Start()
        {
            // Get relative variables for script use
            _player = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Transform>();
            _playerCam = _player.GetComponent<Camera>();
            _defaultRot = Moveable.rotation.eulerAngles;
            _playerBase = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
            _normalisedDefaultRot = new Vector3(0, _defaultRot.y, 0);
            _cam = GetComponent<Camera>();
            _cam.fieldOfView = _player.GetComponent<Camera>().fieldOfView;

            // Get the positions of the area bounds
            _bounds = new Vector3[Bounds.Length];
            for (int i = 0; i < Bounds.Length; i++) {
                _bounds[i] = Bounds[i].position;
            }

            // If there are requests for additional render depths, create the requirements
            _additionalDepthRenderers = new GameObject[Helper.renderDepth];
            for (int i = 0; i < Helper.renderDepth; i++) {
                _additionalDepthRenderers[i] = Instantiate(Moveable.gameObject);
                _additionalDepthRenderers[i].GetComponentInChildren<CameraRenderPosition>().enabled = false;
                _additionalDepthRenderers[i].GetComponentInChildren<Camera>().depth = -(i + 2);
                _additionalDepthRenderers[i].transform.parent = Moveable.parent;
            }

            // Get rotation Quaternions between the two points
            _relativePlayerRot = Quaternion.FromToRotation(RenderPosition.forward, -PointOfView.forward);
            _relativePortalRot = Quaternion.FromToRotation(RenderPosition.forward, PointOfView.forward);

            // Get external script references
            _linkedScript = PointOfView.GetComponentInChildren<CameraRenderPosition>();
            _playerControl = _player.GetComponentInParent<OVRPlayerController>();
        }
Example #41
0
	// Use this for initialization
	void Start () {
		pauseScreen.SetActive (false);
		player = GameObject.FindWithTag ("Player");
		playerController = player.GetComponent<OVRPlayerController> ();
	}
Example #42
0
    /// <summary>
    /// Awake this instance.
    /// </summary>
    void Awake()
    {
        // Find camera controller
        OVRCameraController[] CameraControllers;
        CameraControllers = gameObject.GetComponentsInChildren<OVRCameraController>();

        if(CameraControllers.Length == 0)
            Debug.LogWarning("OVRMainMenu: No OVRCameraController attached.");
        else if (CameraControllers.Length > 1)
            Debug.LogWarning("OVRMainMenu: More then 1 OVRCameraController attached.");
        else{
            CameraController = CameraControllers[0];
        }

        // Find player controller
        OVRPlayerController[] PlayerControllers;
        PlayerControllers = gameObject.GetComponentsInChildren<OVRPlayerController>();

        if(PlayerControllers.Length == 0)
            Debug.LogWarning("OVRMainMenu: No OVRPlayerController attached.");
        else if (PlayerControllers.Length > 1)
            Debug.LogWarning("OVRMainMenu: More then 1 OVRPlayerController attached.");
        else{
            PlayerController = PlayerControllers[0];
        }
    }
Example #43
0
 /// <summary>
 /// Sets the OVR player controller.
 /// </summary>
 /// <param name="ovrPlayerController">player controller.</param>
 public void SetPlayerController(ref OVRPlayerController ovrPlayerController)
 {
     playerController = ovrPlayerController;
 }