public var fadeOutTexture : Texture2D;
public var fadeSpeed = 0.3;
var drawDepth = -1000;
private var alpha = 1.0;
private var fadeDir = -1;

function OnGUI()
{
    alpha += fadeDir * fadeSpeed * Time.deltaTime; 
    alpha = Mathf.Clamp01(alpha);  
    GUI.color.a = alpha;
    GUI.depth = drawDepth;
    GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), fadeOutTexture);
}

function fadeIn()
{
    fadeDir = -1;  
}

function fadeOut()
{
    fadeDir = 1;  
}

function Start()
{
    alpha=1;
    fadeIn();
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-08-16
  • 2022-01-08
  • 2021-11-01
  • 2021-11-06
猜你喜欢
  • 2021-12-19
  • 2021-09-12
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案