例如:相机背景颜色的改变,尺寸的缩小
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);/场景的重新加载
}