Example #1
0
    void ObjectRay2()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            objectScript = rayed.GetComponent <ObjectScript> ();

            if (objectScript.rightInstrument == instrumentScript.instrName)
            {
                rightAnswers++;
                //Открыть замок
                if (objectScript.isLocked == true)
                {
                    objectScript.Opening();
                    wrong.text = null;
                }
                else
                {
                    wrong.text = "Замок уже открыт";
                }

                //rayed.SetActive (false);
                //Открыть крышку
                if (lockScript.isLocked)
                {
                    lockScript.Check();
                }
            }
            else
            {
                wrongAnswers++;
                Debug.Log("wrong instrument");
                wrong.text = "Нужен другой инструмент";
            }
        }
    }