コード例 #1
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject == DoorCloseCol)
        {
            gateSound.GetComponent <AudioSource>().PlayOneShot(twoDoorsClosed, 0.9f);
            DoorCloser = true;
            StartCoroutine(gameObject.GetComponent <ObjectHint>().DoorCloser());
            Destroy(DoorCloseCol);
            KeyNow = true;
            swingStopCol.SetActive(true);
            swing.GetComponent <AudioSource>().Play();
            swing.GetComponent <Animator>().SetFloat("startSwing", 1);
            SoundStarter.SetActive(true);
        }

        if (col.gameObject == swingStopCol)
        {
            swing.GetComponent <Animator>().SetFloat("startSwing", -1);
            swing.GetComponent <AudioSource>().Stop();
        }
    }