示例#1
0
    // void that takes animation times ( how long anim will last )

    IEnumerator PlayAnimation(float animTime, GameObject hitGameobject,
                              GameObject animArms, GameObject animCam)
    {
        objectiveManagerScript.HideText();
        cutsceneFade.GetComponent <ScreenFade>().StopAllCoroutines();
        cutsceneFade.GetComponent <ScreenFade>().BeginCutscene();
        yield return(new WaitForSeconds(0.35f));

        hitGameobject.SetActive(false);

        // stops fade in
        cutsceneFade.GetComponent <ScreenFade>().EndCutsceneFade();

        // enables animtions
        animCam.SetActive(true);
        animArms.SetActive(true);

        // Waits animation time to begin fade in / out
        yield return(new WaitForSeconds(animTime));

        // Just in case for some reason the courintine didnt finish this makes it finish
        cutsceneFade.GetComponent <ScreenFade>().StopAllCoroutines();
        yield return(new WaitForSeconds(0.10f));

        cutsceneFade.GetComponent <ScreenFade>().BeginCutscene();
        yield return(new WaitForSeconds(0.35f));

        cutsceneFade.GetComponent <ScreenFade>().EndCutsceneFade();

        // adds item progress to manager
        objectiveManager.GetComponent <ObjectiveManager>().itemCollected++;
        objectiveManager.GetComponent <ObjectiveManager>().Objective();

        // disables animation
        animCam.SetActive(false);
        animArms.SetActive(false);

        MouseLook.canLook           = true;
        PlayerMovement.stopMovement = false;
        //  pickUpArm.transform.position += new Vector3(0, -0.25f, 0);
        objectiveManagerScript.ShowText();
    }