Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 void Start()
 {
     head = this.gameObject.GetComponentInChildren <StereoController>().Head;
     //onDoubleTap.AddListener (doubleClickThisFrame );
     rgdBody = this.GetComponent <Rigidbody> ();
     head.transform.forward = this.transform.forward;
 }
Ejemplo n.º 2
0
    void Start()
    {
        rb = GetComponent <Rigidbody>();
        Debug.Log("Setting color " + chosenColor);
        foreach (Material mat in gameObject.GetComponent <MeshRenderer>().materials)
        {
            mat.color = chosenColor;
        }

        if (!isLocalPlayer)
        {
            return;
        }

        //transform.position = Camera.main.transform.position;
        //offset = Camera.main.transform.position - transform.position;

        head = (GvrHead)FindObjectOfType(typeof(GvrHead));
        head.transform.position = transform.position + offset;
        GvrViewer viewer = (GvrViewer)FindObjectOfType(typeof(GvrViewer));

        viewer.Recenter();
        //head.transform.rotation = Quaternion.LookRotation(Vector3.zero - head.transform.position);
        //Camera.main.transform.position = transform.position + offset;
        //Camera.main.transform.rotation = Quaternion.LookRotation(Vector3.zero - Camera.main.transform.position);
    }
    public void Start()
    {
        cardboard = gameObject.GetComponent <CardboardControl>();
        StereoController stereoController = Camera.main.GetComponent <StereoController>();

        head = stereoController.Head;
    }
Ejemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     GvrViewer.Instance.OnTrigger += PullTrigger;
     head  = GameObject.FindObjectOfType <GvrHead> ();
     rb    = GetComponent <Rigidbody> ();
     state = GameObject.FindObjectOfType <LevelState> ();
 }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        try
        {
            GvrHead gvrhead = GetComponent <GvrHead>();
            Destroy(gvrhead);
            GvrViewer gvrviewer = GameObject.Find("GvrViewerMain").GetComponent <GvrViewer>();
            gvrviewer.VRModeEnabled = false;
        }
        catch (System.Exception ex)
        {
        }
        float x, y;

        x = Input.GetAxis("Vertical") * -2;
        y = Input.GetAxis("Horizontal") * 2;
        if (x == 0 && y == 0)
        {
            x = Input.GetAxis("Mouse Y") * -2;
            y = Input.GetAxis("Mouse X") * 2;
            if (x != 0 && y != 0)
            {
                Cursor.visible = false;
            }
        }
        else
        {
            Cursor.visible = true;
        }
        xrot       += x;
        yrot       += y;
        tf.rotation = Quaternion.Euler(xrot, yrot, 0);
        Debug.Log(x + " " + y + " " + yrot + " " + xrot);
    }
Ejemplo n.º 6
0
 void Start()
 {
     head                      = GameObject.FindObjectOfType <GvrHead> ();
     gvrViewer                 = GameObject.FindObjectOfType <GvrViewer> ();
     inventory                 = GameObject.FindObjectOfType <Inventory>();
     resourceMining            = GameObject.FindObjectOfType <ResourceMining> ();
     inventory.reticleOnObject = false;
 }
Ejemplo n.º 7
0
 public override void Start()
 {
     base.Start();
     startForward          = nowForward = Vector3.zero;
     player                = GameKernel._instance.gameObject;
     cameras               = player.GetComponentsInChildren <Camera>();
     gvrViewer             = player.GetComponent <GvrViewer>();
     gvrHead               = player.GetComponentInChildren <GvrHead>();
     playerStates          = states.other;
     gvrHead.trackRotation = false;
 }
Ejemplo n.º 8
0
 void Start()
 {
     startingPosition = transform.localPosition;
     inventory        = GameObject.FindObjectOfType <Inventory>();
     player           = FindObjectOfType <GvrHead>();
     glow             = GetComponent <Glow> ();
     displayCanvas    = FindObjectOfType <DisplayCanvas> ();
     if (glow == null)
     {
         glow = GetComponentInChildren <Glow> ();
     }
 }
Ejemplo n.º 9
0
 void Start()
 {
     startingPosition = transform.localPosition;
     inventory        = GameObject.FindObjectOfType <Inventory>();
     player           = FindObjectOfType <GvrHead>();
     healthManagement = FindObjectOfType <HealthManagement> ();
     glow             = GetComponent <Glow> ();
     if (glow == null)
     {
         glow = GetComponentInChildren <Glow> ();
     }
 }
Ejemplo n.º 10
0
 // Update is called once per frame
 void Update()
 {
     if (!gameState)
     {
         SceneManager.LoadScene(0);              //Catches Null Exception of game state and just loads the beginning scene again.
     }
     FrogHead = FindObjectOfType <GvrHead>();
     //Allow the player to start jumping if the game is being played (After the player presses the "Escape" button)
     if (!gameState.IsIdle && !gameState.IsGameOver)
     {
         allowJump = true;
     }
     else
     {
         allowJump = false;
     }
 }
Ejemplo n.º 11
0
    private void Awake()
    {
        if (mInstant != null)
        {
            DestroyImmediate(this);
        }
        mInstant = this;

        LogTool.Log("开始查找Env 和 UI");
        //CinemaUI = GameObject.FindGameObjectWithTag("CinemaUI");
        GvrHead = Camera.main.gameObject.GetComponent <GvrHead>();
        IsPointerEnterVideoPlayerUI = false;
        IsPlayEndWhenKTTVModel      = false;
        IsInFocus          = false;
        IsInLockAngle      = false;
        IsFirstInLockAngle = false;
    }
Ejemplo n.º 12
0
        public override void StartController(InstantVR ivr)
        {
            base.StartController(ivr);
#if UNITY_ANDROID
            if (extension == null)
            {
                extension = ivr.GetComponent <IVR_Cardboard>();
            }

            Camera camera = CheckCamera();
            if (camera != null)
            {
                cameraTransform = camera.transform;
                neck2eyes       = HeadUtils.GetNeckEyeDelta(ivr);

                cameraTransform.gameObject.SetActive(false);

                GvrViewer cardboardPrefab = Resources.Load <GvrViewer>("CardboardPrefab");
                cardboard = Instantiate(cardboardPrefab);
                if (cardboard == null)
                {
                    Debug.LogError("Could not instantiate Cardboard. CardboardCameraRig is missing?");
                }
                else
                {
                    cameraRoot = cardboard.gameObject;
                    cameraRoot.transform.parent = ivr.transform;

                    cameraRoot.transform.position = transform.position;
                    cameraRoot.transform.rotation = ivr.transform.rotation;

                    GvrHead gvrHead = cardboard.GetComponentInChildren <GvrHead>();
                    if (gvrHead != null)
                    {
                        camera          = Camera.main;
                        cameraTransform = Camera.main.transform;
                    }
                }
            }
            controller = Controllers.GetController(0);
#if INSTANTVR_ADVANCED
            vicoVRHead = GetComponent <IVR_VicoVRHead>();
#endif
#endif
        }
Ejemplo n.º 13
0
 void Start()
 {
     gvrMain = FindObjectOfType<GvrViewer>();
     gvrHead = FindObjectOfType<GvrHead>();
 }
 void Awake()
 {
     _instance = this;
     player    = GameObject.FindGameObjectsWithTag(Constants.goPlayer) [0] as GameObject;
     head      = Camera.main.GetComponent <StereoController>().Head;
 }
Ejemplo n.º 15
0
 void Start()
 {
     head = Camera.main.GetComponent <StereoController>().Head;
 }
Ejemplo n.º 16
0
 void Start()
 {
     head = GetComponentInChildren <StereoController>().Head;
     // head = ;
 }
Ejemplo n.º 17
0
 /// Clear the cached array of GvrEye children, as well as the GvrHead that controls
 /// their gaze.
 /// @note Be sure to call this if you programmatically change the set of GvrEye children
 /// managed by this StereoController.
 public void InvalidateEyes()
 {
     #if !UNITY_EDITOR
     eyes = null;
     head = null;
     #endif
 }
Ejemplo n.º 18
0
 // Update is called once per frame
 void Update()
 {
     FrogHead = FindObjectOfType <GvrHead>();
 }
Ejemplo n.º 19
0
 static void BuildGearVRSettings()
 {
     PlayerSettings.virtualRealitySupported = true;
     GvrViewer cardboard    = (GvrViewer)GameObject.FindGameObjectWithTag("Player").GetComponent <GvrViewer>();
     GvrHead   carboardHead = cardboard.gameObject.transform.GetChild(0).GetComponent <GvrHead>();
 }