动画的出现

例如:相机背景颜色的改变,尺寸的缩小

IEnumerator GameOverAnimation()//动画的出现
    {
    
    
        while(true)
        {
    
    
            mainCamera.backgroundColor = Color.Lerp(mainCamera.backgroundColor, Color.red, speed * Time.deltaTime);
            mainCamera.orthographicSize = Mathf.Lerp(mainCamera.orthographicSize, 4, speed * Time.deltaTime);
            if(Mathf.Abs(mainCamera.orthographicSize-4)<0.01)
            {
    
    
                break;
            }
            yield return 0;
        }
        yield return new WaitForSeconds(1);
       // SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);/场景的重新加载
    }

猜你喜欢

转载自blog.csdn.net/qq_46289420/article/details/109299330