예제 #1
0
    void OnTriggerStay2D(Collider2D other)
    {
        //when player 1 is active
        if (Input.GetKey(KeyCode.E) && rndDialogs1.GetComponent <BoxCollider2D>().IsTouching(rndDialogs2.GetComponent <BoxCollider2D>()) == true &&
            mvm2.GetComponent <MovementControl2>().enabled == false)
        {
            dManager.ShowBox(dialogue);
        }



        //when player 2 is active
        if (Input.GetKey(KeyCode.E) && rndDialogs2.GetComponent <BoxCollider2D> ().IsTouching(rndDialogs1.GetComponent <BoxCollider2D> ()) == true &&
            mvm1.GetComponent <Movement>().enabled == false && inTrigger)
        {
            //dManager.ShowBox(dialogue);

            if (!dManager.dialogActive)
            {
                dManager.dialogsLines = dLines;
                dManager.CurrentLine  = 0;
                dManager.ShowDialog();
            }
        }
    }
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Player" && !close)
        {
            //if (Input.GetKeyDown(KeyCode.Space)) // should make you press space first, but not working.
            //{
            dMan.ShowBox(dialogue);
            //}

            close = true;
        }
    }