示例#1
0
    void Update()
    {
        if (!magnetDetectionEnabled)
        {
            return;
        }
        if (CardboardMagnetSensor.CheckIfWasClicked())
        {
            ///PARTIE IMPROVISEE
            RaycastHit hit;
            Ray        ray     = Camera.main.ScreenPointToRay(Input.mousePosition);
            bool       collide = Physics.Raycast(ray, out hit); //merci doc unity
            if (collide && hit.collider.tag == "button")        // hit est pas initialisé
            {
                Transform objectHit = hit.transform;
                Debug.Log("Youpi !");
                //GameObject collidedGameObject = hit.collider.gameObject;//on récupère l'objet auquel appartien le collider :D
                //callbackObject = collidedGameObject.GetComponent<TypeDeLObjet>();//on récupère l'objet contenant l'action à effectuer ( ce que tu appèlle avec le Onclic je pense)
                //callbackObject.OnClick();//on appèle la callback sans fautes d'orthographe ;)
                //ChangeScene blabla = this.gameObject.GetComponent<ChangeScene>();
                GameObject collidedGameObject = hit.collider.gameObject;
                //collidedGameObject.GetComponent<SceneChanger>().Change();// ça c'est ok
            }
            ///
            Debug.Log("DO SOMETHING HERE");  // PERFORM ACTION.

            CardboardMagnetSensor.ResetClick();
        }
    }
示例#2
0
 void Update()
 {
     if (CardboardMagnetSensor.CheckIfWasClicked() || Input.GetMouseButtonDown(0))
     {
         gameManager.IsOn_Magnet = true;
         CardboardMagnetSensor.ResetClick();
     }
 }
示例#3
0
    void Update()
    {
        if (CardboardMagnetSensor.CheckIfWasClicked())
        {
            gameManager.IsOnMagnet = true;

            CardboardMagnetSensor.ResetClick();
        }
    }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        timeBar.fillAmount = (gameDuration - Time.timeSinceLevelLoad) / gameDuration;

        if (timeBar.fillAmount == 0)
        {
            Application.LoadLevel(2);
            CardboardMagnetSensor.ResetClick();
        }
    }
示例#5
0
    private void Update()
    {
        if (CardboardMagnetSensor.CheckIfWasClicked() || Input.GetMouseButtonDown(0))
        {
            GameObject clone = Instantiate(box_prefab);

            float fx = UnityEngine.Random.Range(-0.4f, -0.4f);
            float fz = UnityEngine.Random.Range(-0.4f, -0.4f);
            clone.transform.position = new Vector3(fx, 4.0f, fz);
            clone.GetComponent <Renderer>().material.color = new Color(UnityEngine.Random.value, UnityEngine.Random.value, UnityEngine.Random.value);

            CardboardMagnetSensor.ResetClick();
        }
    }
示例#6
0
    void Update()
    {
        if (!magnetDetectionEnabled)
        {
            return;
        }

        if (Cardboard.SDK.CardboardTriggered)
        {
            Application.LoadLevel(1);
            Assets.Scripts.PlayerCounter.PlayerScore = 0;
            CardboardMagnetSensor.ResetClick();
        }
    }
示例#7
0
    void Update()
    {
        if (!magnetDetectionEnabled)
        {
            return;
        }

        if (Cardboard.SDK.CardboardTriggered)
        {
            GameObject         FPSController = GameObject.Find("Head");
            FPSInputController autowalk      = FPSController.GetComponent <FPSInputController>();
            autowalk.checkAutoWalk = !autowalk.checkAutoWalk;
            CardboardMagnetSensor.ResetClick();
        }
    }
示例#8
0
    void Update()
    {
        if (CardboardMagnetSensor.CheckIfWasClicked() || Input.GetMouseButtonDown(0))
        {
            if (curScene == 0)
            {
                introManager.IsOnMagnet = true;
            }
            else if (curScene == 1)
            {
                gameManager.IsOnMagnet = true;
            }

            CardboardMagnetSensor.ResetClick();
        }
    }
示例#9
0
    // Update is called once per frame
    void Update()
    {
        if (!magnetDetectionEnabled)
        {
            return;
        }

        if (CardboardMagnetSensor.CheckIfWasClicked())
        {
            Debug.Log("DO SOMETHING HERE");              // PERFORM ACTION.
            MachineGunController._instance.vrShootBullet();
            CardboardMagnetSensor.ResetClick();
        }

        if (Input.GetButtonDown("Fire1"))
        {
            MachineGunController._instance.vrShootBullet();
        }
    }
示例#10
0
 // Update is called once per frame
 void Update()
 {
     if (!magnetDetectionEnabled)
     {
         return;
     }
     if (CardboardMagnetSensor.CheckIfWasClicked() || Input.GetMouseButtonDown(0))
     {
         if (!isStarted)
         {
             PlayGame();
         }
         else if (playerObj.canRestartGame())
         {
             RestartGame();
         }
         CardboardMagnetSensor.ResetClick();
     }
     if (playerObj.canRestartGame())
     {
         StopMonsters();
     }
 }