예제 #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject   Dave = GameObject.Find("Dave");
        DaveCollider daveColliderScript = Dave.GetComponent <DaveCollider>();



        if (dialoguePreEnd == true && daveColliderScript.dialoguePlayed == false)
        {
            dialoguePreEnd = false;

            Instantiate(dialoguePrefab);

            Invoke("preDialogue", 6f);
        }


        if (dialogue1End == true && daveColliderScript.dialoguePlayed == true)
        {
            dialogue1End = false;



            Invoke("fadeOut", 0.5f);
        }
    }
예제 #2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        GameObject    Door       = GameObject.Find("Door Collider");
        DoorCollider1 doorScript = Door.GetComponent <DoorCollider1>();


        GameObject   Dave = GameObject.Find("Dave");
        DaveCollider daveColliderScript = Dave.GetComponent <DaveCollider>();

        GameObject   Jess = GameObject.Find("Jessiqoi");
        JessCollider jessColliderScript = Jess.GetComponent <JessCollider>();


        if (inDialogue == false)
        {
            float x = Input.GetAxis("Horizontal");
            float y = Input.GetAxis("Vertical");

            speed = 3.5f;

            if (doorScript.dialogue1End == false || daveColliderScript.inDialogue == true || jessColliderScript.inDialogue == true)
            {
                speed = 0;
            }



            rigibody.velocity = new Vector2(x, y) * speed;

            rigibody.angularVelocity = 0f;

            if (transform.position.x > 8.5 && transform.position.x < 9 && isDialogue == false)
            {
                Dialogue1();
            }
        }
    }