Exemplo n.º 1
0
    IEnumerator deathSpeaks()
    {
        yield return(new WaitUntil(() => startingCameraPan.movementFlag == true));

        yield return(new WaitForSeconds(1f));

        deathSpeak.StartTalking(true);
        yield return(new WaitForSeconds(0.5f));

        yield return(new WaitUntil(() => Input.GetButton("Fire1") || Input.GetButton("Jump")));

        deathSpeak.updateTextBox();
        yield return(new WaitForSeconds(0.5f));

        yield return(new WaitUntil(() => Input.GetButton("Fire1") || Input.GetButton("Jump")));

        deathSpeak.updateTextBox();
        yield return(new WaitForSeconds(1.5f));

        deathMove.canMove = true;
        yield return(new WaitUntil(() => deathMove.movementFlag == true));

        Debug.Log("death end");
        deathOBJ.SetActive(false);
        skyDimmer.CrossFadeAlpha(0.5f, 2.0f, false);
        yield return(new WaitForSeconds(2.5f));

        graveAnim.SetTrigger("Grave");
        yield return(new WaitForSeconds(5f));

        graveAnim.SetTrigger("Grave");
        scriptManager.playerAnimator.playerAnim.SetTrigger("Start");
        skyDimmer.enabled = false;
    }
Exemplo n.º 2
0
    IEnumerator castRay()      //Essentially, this fires a raycast on mouseclick: if it hits an object, if that object is Holdable, or the Player, you'll be able to move that object around with the HoldObjectMovement script. If that object is dialogue, you can talk to it.
    {
        yield return(new WaitUntil(() => Input.GetButton("Fire1") && clickTime == false && scriptManager.playerAnimator.canMove == true));

        StartCoroutine(clickTimer());
        RaycastHit2D hit = Physics2D.GetRayIntersection(cam.ScreenPointToRay(Input.mousePosition));

        StartCoroutine(castRay());
        if (hit.transform.tag == "Player" && isTalking == false)
        {
            scriptManager.holdObjectMovement.heldObject = hit.transform.gameObject;
            scriptManager.holdObjectMovement.HoldObject();
            holdingSelf = true;
        }
        else if (hit.collider != null)
        {
            foreach (Transform child in hit.transform)
            {
                if (child.tag == "Holdable" && isTalking == false && holdingSelf == false)
                {
                    scriptManager.playerAnimator.StartHolding();
                    scriptManager.holdObjectMovement.heldObject = hit.transform.gameObject;
                    scriptManager.holdObjectMovement.HoldObject();
                }
                else if (child.tag == "Dialogue" && holdingSelf == false)
                {
                    talkToObject = hit.collider.GetComponent <TalkToObject>();
                    talkToObject.StartTalking(false);
                }
                else if (child.tag == "DialogueContinue" && talkToObject.talkToCollider.enabled == true && holdingSelf == false) //These objects can continue existing dialogue, but not start new ones. (i.e. text boxes)
                {
                    talkToObject.updateTextBox();
                }
            }
        }
    }