Beispiel #1
0
    public void OnReceived(EBEvent e)
    {
        switch (e.type)
        {
        case EBEventType.InteractionWithDoor:
        {
            DoorInteractionEvent die = e as DoorInteractionEvent;
            if (!isDoorTriggered && (die.door == door))
            {
                isDoorTriggered = true;
                monster.SetActive(true);
                monster.GetComponent <CameraVisibilityChecker>().SetCamera(camera);
                monster.GetComponent <MonsterBehaviour>().SetMainTarget(controller.transform);
                NoiseEffectsManager noiseEffectsManager = controller.gameObject.GetComponentInChildren <NoiseEffectsManager>();
                noiseEffectsManager.SetMonster(monster.transform);
                noiseEffectsManager.enabled = true;
                dispatcher.Subscribe(EBEventType.CaughtByMonster, address, gameObject);
                dispatcher.Subscribe(EBEventType.MonsterInFrustum, address, gameObject);
            }
        }
        break;

        case EBEventType.CaughtByMonster:
            StartCoroutine(EndingAnimation());
            break;

        case EBEventType.MonsterInFrustum:
            controller.SetMouseLookEnabled(false);
            controller.SetHeadBobEnabled(false);
            controller.enabled = false;
            director.StartAnimating(camera, rotationTarget, camera.transform);
            break;
        }
    }
    private IEnumerator Animation()
    {
        RenderSettings.fog = false;
        camera.gameObject.GetComponent <UnityStandardAssets.CinematicEffects.AmbientOcclusion>().enabled = false;
        light.SetActive(true);
        controller.SetMouseLookEnabled(false);
        controller.SetHeadBobEnabled(false);
        controller.enabled = false;
        birds.Play();
        director.StartAnimating(camera, rotationTarget, movementTarget);
        yield return(new WaitUntil(() => director.IsFinished()));

        yield return(new WaitForSeconds(1.0f));

        TextOutput textOutput = TextOutput.GetInstance();

        textOutput.ShowText(TextManager.GetGoodEndingText(), TextOutput.TextAreaSize.Small);
        yield return(new WaitWhile(() => textOutput.IsActive()));

        UnityEngine.SceneManagement.SceneManager.LoadScene("Main");
    }