// clone effect based on other instance public Effects(Effects cloneTarget) { page = cloneTarget.page; duration = cloneTarget.duration; fadeMode = cloneTarget.fadeMode; cameraEffects = new CameraEffects(cloneTarget.cameraEffects); }
public void SetFadeOut() { time = fadeOutTime; mode = fadeMode.fadeout; fadeImage.enabled = true; isFading = true; }
// create new effect woth default value public Effects() { page = 0; duration = 1; fadeMode = fadeMode.none; cameraEffects = new CameraEffects(); }
public void SetFadeIn() { time = fadeInTime; mode = fadeMode.fadein; fadeImage.enabled = true; isFading = true; }
public void UpdateEffect( int pageNo, float duration, fadeMode fadeMode, int index ) { this.Lines[index].Effects.setValue(pageNo, duration, fadeMode, this.Lines[index].Effects.CameraEffects); }
// set value public bool setValue(int newPage, float newDuration, fadeMode newFadeMode, CameraEffects newCameraEffects) { try { this.page = newPage; this.duration = newDuration; this.fadeMode = newFadeMode; this.cameraEffects = newCameraEffects; return(true); } catch (System.Exception) { return(false); } }
public bool update(int pej, float durat, fadeMode fm, CamEffects camfx) { try { this.page = pej; this.duration = durat; this.fadeMode = fm; this.cameraEffects = camfx; return(true); } catch (System.Exception) { return(false); } }
public void UpdateAll( string character, string message, int pageNo, float duration, fadeMode fadeMode, float camsz, Vector3 camPos, float camshake, Color bgcolor, int index) { UpdateCameraEffect(camPos, camsz, camshake, bgcolor, index); UpdateEffect(pageNo, duration, fadeMode, index); UpdateLine(character, message, index); }
//Fade function void fade() { //Performs acording to the current fade mode switch (fadeMod) { case fadeMode.fadeOut: //fade out alpha = fadeSpeed * timer; //computes alpha = speed * elapsed_time alpha = Mathf.Clamp01(alpha); if (timer >= totFadDur / 3.0f) //checks if first third of total time has passed { fadeMod = fadeMode.fadePause; } break; case fadeMode.fadePause: if (timer >= totFadDur * 2.0f / 3.0f) //checks if two thirds of total time have passed { fadeMod = fadeMode.fadeIn; } break; case fadeMode.fadeIn: //fade in alpha = 1.0f - fadeSpeed * (timer - totFadDur * 2.0f / 3.0f); ////computes alpha = speed * elapsed_time alpha = Mathf.Clamp01(alpha); if (timer >= totFadDur) //checks if total time has passed { fadeMod = fadeMode.fadeNot; } break; case fadeMode.fadeNot: //deactivates fading and resets settings fadeActive = false; fadeMod = fadeMode.fadeOut; break; } //switch GUI.depth = -1000; //huge negative value to paint on top of everything GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, alpha); //updates alpha value GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture); //prints texture } //fade ()
//fading effect void spriteFade(fadeMode fadeM) { if (times < duration) { times += Time.deltaTime; } else { times = duration; } if (fadeM == fadeMode.color) { colorFade(); } else if (fadeM == fadeMode.transition) { transitionFade(); } }
public Effects(int pej, float durat, fadeMode fm, CamEffects camfx) { update(pej, durat, fm, camfx); }