private void Update() { time += Time.deltaTime; switch (stage) { case CreditsStage.Idle: break; case CreditsStage.IsWaiting: if (time >= delay) { stage = CreditsStage.IsStarting; time = 0; } break; case CreditsStage.IsStarting: color.a = time / fadeIn; if (time >= fadeIn) { stage = CreditsStage.IsShowing; time = 0; } break; case CreditsStage.IsShowing: if (time >= duration) { stage = CreditsStage.IsEnding; time = 0; } break; case CreditsStage.IsEnding: color.a = (fadeOut - time) / fadeOut; if (time >= fadeOut) { stage = CreditsStage.HasEnded; time = 0; } break; case CreditsStage.HasEnded: if (nextCredits != null) { nextCredits.StartCredits(); } stage = CreditsStage.Idle; break; } }
private void Start() { menu = GetComponent <DeathMenu>(); stage = CreditsStage.Idle; style = new GUIStyle(); titleWidth = style.CalcSize(new GUIContent(title)).x + 4f; //nameWidth = style.CalcSize(new GUIContent(name)).x * 1.2f; }
public void StartCredits() { stage = CreditsStage.IsWaiting; color = new Color(1f, 1f, 1f, 0f); }