示例#1
0
    void CheckHitObj()
    {
        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, reachRange))
        {
            codeLock = hit.transform.gameObject.GetComponentInParent <CodeLock>();//Witch codelock is beeing pressed

            if (codeLock != null)
            {
                string value = hit.transform.name;
                codeLock.SetValue(value);
            }
        }
    }
    void CheckHitObj()
    {
        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, reachRange))
        {
            codeLock = hit.transform.gameObject.GetComponentInParent <CodeLock>();

            if (codeLock != null)
            {
                string value = hit.transform.name; //버튼의 이름을 숫자로 설정해서 CodeLock의 SetValue 메소들로 보냈어요.
                codeLock.SetValue(value);
            }
        }
    }
示例#3
0
    void CheckHitObj()
    {
        RaycastHit hit;                                                            //sto udara kamera
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);        //zraka iz kamere se postavlja na poziciju misa

        if (Physics.Raycast(ray, out hit, reachRange))                             //provjera "hit-a"
        {
            codeLock = hit.transform.gameObject.GetComponentInParent <CodeLock>(); //uzimamo objekt koji udari

            if (codeLock != null)                                                  //ako udari
            {
                string value = hit.transform.name;                                 //value=ime objekta koje je udarilo(tipke odnosno brojke u nasem slucaju keypada)
                codeLock.SetValue(value);                                          //prosljeduje se vrijednost na sljedecu skritu
                //Debug.Log(value);     //cisto radi provjere u debugeru
                press.PlayOneShot(press_sound);                                    //pokretanje zvuka
            }
        }
    }