// Use this for initialization void Awake() { fadeMat = renderer.sharedMaterial; finishedTransition = false; fadeDir = EnumFadeDirection.FADE_NONE; // register this class with ScreenLayoutManager for screen resize event GUIScreenLayoutManager.Instance.register(this); }
private bool finishedTransition; // true if the fade could finish void Awake() { // create the texture manually tex = new Texture2D(1, 1, TextureFormat.Alpha8, false); tex.SetPixel(1, 1, fadeColor); // create the rectangle where the texture will fill in rectTex = new Rect(0, 0, Screen.width, Screen.height); finishedTransition = false; fadeDir = EnumFadeDirection.FADE_NONE; // disable by default this.enabled = false; GUIScreenLayoutManager.Instance.register(this); }
public void startFading(EnumFadeDirection direction) { this.enabled = true; // keeps the fade direction for the fade transition fadeDir = direction; // reset status finishedTransition = false; // sets starting alpha values depending on the fade direction if (direction.Equals(EnumFadeDirection.FADE_IN)) { alphaFadeValue = 0f; } else if (direction.Equals(EnumFadeDirection.FADE_OUT)) { alphaFadeValue = 1f; } }
public void stopFading() { this.enabled = false; fadeDir = EnumFadeDirection.FADE_NONE; finishedTransition = true; }