Пример #1
0
    private IEnumerator AnimateGameOver(Frank frank)
    {
        var t           = 0.0f;
        var frankStart  = frank.transform.position;
        var cameraStart = GameCamera.transform.position;

        while (t < cameraTime)
        {
            t += Time.deltaTime;
            frank.transform.position = Vector3.Lerp(frankStart, endTarget.position, t / cameraTime);
            var camPos = Vector3.Lerp(cameraStart, endTarget.position, t / cameraTime);
            camPos.z = cameraStart.z;
            GameCamera.transform.position = camPos;
            GameCamera.CheckBounds();
            yield return(null);
        }
        frank.transform.SetParent(endTarget);
        frank.finalSkip = false;
        t = 0.0f;
        var startBoat = endTarget.position;

        SFXManager.Instance.PlaySFX("Rowing");
        while (t < endTime)
        {
            t += Time.deltaTime;
            endTarget.transform.position = Vector3.Lerp(
                startBoat, endTarget2.position, t / endTime);
            yield return(null);
        }
        SFXManager.Instance.PlaySFX("GameOver");
        gameOverScreen.SetActive(true);
    }