private void ForceFadeOut(int fadeTime) { this.frame = 0; this.alpha = 255; this.fadeOutTime = fadeTime; this.state = CreditState.FadingOut; }
public Credit( IAudioEngine s, EventManager m, string key, Point position, bool centered, bool movesWithCamera, int fadeInTime, int hangTime, int fadeOutTime, SceneMap parent, SaveData save) : base(s, m, save) { this.NoTimeNext = false; this.parent = parent; this.creditKey = key; this.position = new Vector2(position.X, position.Y); this.centered = centered; this.movesWithCamera = movesWithCamera; this.fadeInTime = fadeInTime; this.hangTime = hangTime; this.fadeOutTime = fadeOutTime; if (this.hangTime < 0) { this.PersistentId = this.hangTime == -1 ? this.fadeOutTime : this.fadeInTime; } this.state = CreditState.FadingIn; this.alpha = 0; }
private State GetState(States state) { State result; switch (state) { case States.SPLASH: result = new SplashState(this); break; case States.GAME: result = new GameState(this); break; case States.PAUSE: result = new PauseState(this, CurrentState.StateIdentifier); break; case States.MAINMENU: result = new MainMenuState(this); break; case States.CREDIT: result = new CreditState(this); break; default: result = new FailState(this); break; } return(result); }
public void PersistentUpdate() { this.FlameControl(1); switch (this.state) { case CreditState.FadingIn: if (this.frame >= this.fadeInTime) { this.frame = 0; this.alpha = 255; this.state = CreditState.Hanging; } else { this.alpha = (int)Math.Round(255.0 * (double)this.frame / this.fadeInTime); } break; case CreditState.Hanging: if (this.hangTime != FadeIn && this.frame >= this.hangTime) { this.frame = 0; this.alpha = 255; this.state = CreditState.FadingOut; } break; case CreditState.FadingOut: if (this.frame >= this.fadeOutTime) { this.frame = 0; this.alpha = 0; this.state = CreditState.FadingIn; this.IsActive = false; } else { this.alpha = 255 - (int)Math.Round(255.0 * (double)this.frame / this.fadeOutTime); } break; } }