예제 #1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit, 100f))
            {
                if (hit.transform.tag == "poster")
                {
                    screenStart.transform.localPosition = new Vector3(
                        hit.transform.localPosition.x - 0.01f,
                        5.88f,
                        hit.transform.localPosition.z
                        );
                }

                if (hit.transform.tag == "playButton")
                {
                    this.DestroyScreenChooseGame();
                    this.InitGame();
                }

                if (hit.transform.tag == "closeButton")
                {
                    this.DestroyGame();
                    this.InitFinal();
                }

                if (hit.transform.tag == "buyButton")
                {
                    Application.OpenURL("https://www.meloman.ru/calendar/?hall=koncertnyj-zal-chajkovskogo");
                }

                if (hit.transform.tag == "exitButton")
                {
                    this.DestroyFinal();
                    this.InitScreenChooseGame();
                }

                AnotherKey key = hit.transform.GetComponent <AnotherKey>();

                if (key != null)
                {
                    if (key.readyToScore)
                    {
                        Debug.Log("Good hit");
                        key.GoodHit();
                    }
                    else
                    {
                        Debug.Log("Bad hit");
                        key.BadHit();
                    }
                }
            }
        }
    }
예제 #2
0
    private void OnTriggerExit(Collider other)
    {
        AnotherKey key = other.GetComponent <AnotherKey>();

        if (key != null)
        {
            key.Die();
        }
    }
예제 #3
0
    private void OnTriggerEnter(Collider other)
    {
        AnotherKey key = other.GetComponent <AnotherKey>();

        if (key != null)
        {
            key.readyToScore = true;
        }
    }