Example #1
0
    public static void EndGame()
    {
        GameObject          player = GameManager.Player;
        InterfaceController interfaceController = player.GetComponent <InterfaceController>();
        GameObject          admiral             = FindGameObjectWithTag("Admiral");

        admiral.GetComponent <DialogTrigger>().DisableInteraction();
        player.transform.parent.GetComponent <EndGameMusic>().PlayMusic();
        Transform cam = Camera.main.transform;

        interfaceController.Clear();
        GameManager.FreezePlayer();
        MonoBehaviour m = player.GetComponent <MonoBehaviour>();

        m.DoDelayed(0.25f, delegate
        {
            Vector3 observationPosition = new Vector3(23.68f, 27.49f, -27.52f);
            Vector3 observationEuler    = new Vector3(90.00001f, 0, 38.817f);

            m.StartCoroutine(SmoothTransformation <Vector3> .SmoothRotateAngleEuler(cam.eulerAngles, observationEuler, 4f, v => cam.eulerAngles = v));
            m.StartCoroutine(
                SmoothTransformation <Vector3> .SmoothRotateEuler(cam.position, observationPosition, 4f, v => cam.position = v, () =>
            {
                interfaceController.DoDelayed(5f, delegate
                {
                    admiral.GetComponent <IntroAdmiral>().JumpInWater();
                });
                Vector3 observationPosition2 = new Vector3(95, 255.7f, -116.1f);
                Vector3 observationEuler2    = new Vector3(51.937f, -38.817f, 0);
                m.StartCoroutine(SmoothTransformation <Vector3> .SmoothRotateAngleEuler(cam.eulerAngles, observationEuler2, 16f, v => cam.eulerAngles = v));
                m.StartCoroutine(
                    SmoothTransformation <Vector3> .SmoothRotateEuler(cam.position, observationPosition2, 17.8f, v => cam.position = v, delegate
                {
                    SceneSwitcher.EnterScene("MenueScene", false, false);
                }));
            })
                );
        });
    }