protected override void TestConditions() { switch (this.PlayerManager.Action) { case ActionType.Dying: break; case ActionType.Suffering: break; case ActionType.SuckedIn: break; default: bool flag = false; foreach (PointCollision pointCollision in this.PlayerManager.CornerCollision) { flag = ((flag ? 1 : 0) | (pointCollision.Instances.Surface == null ? 0 : (pointCollision.Instances.Surface.Trile.ActorSettings.Type == ActorType.Hurt ? 1 : 0))) != 0; if (flag) break; } if (!flag) break; this.PlayerManager.Action = ActionType.Suffering; this.causedByHurtActor = true; this.doneFor = (double) this.PlayerManager.RespawnPosition.Y < (double) this.LevelManager.WaterHeight - 0.25; this.fade = (ScreenFade) null; break; } }
protected override bool Act(TimeSpan elapsed) { this.sinceStarted += elapsed; if (this.fade == null && this.sinceStarted.TotalSeconds > (this.doneFor ? 1.25 : 2.0)) { if (this.doneFor) { this.fade = new ScreenFade(ServiceHelper.Game) { FromColor = ColorEx.TransparentBlack, ToColor = Color.Black, Duration = 1f }; ServiceHelper.AddComponent((IGameComponent) this.fade); this.fade.Faded += new Action(this.Respawn); } else this.PlayerManager.Respawn(); } else this.PlayerManager.BlinkSpeed = Easing.EaseIn(this.sinceStarted.TotalSeconds / (this.doneFor ? 1.25 : 2.0), EasingType.Cubic) * 1.5f; return true; }
protected override bool Act(TimeSpan elapsed) { if (!this.PlayerManager.CanControl) return true; if (this.fade == null && this.sinceHurt.TotalSeconds > (this.doneFor ? 1.25 : 1.0)) { this.sinceHurt = TimeSpan.Zero; this.causedByHurtActor = false; if (this.doneFor) { this.fade = new ScreenFade(ServiceHelper.Game) { FromColor = ColorEx.TransparentBlack, ToColor = Color.Black, Duration = 1f }; ServiceHelper.AddComponent((IGameComponent) this.fade); this.fade.Faded += new Action(this.Respawn); } else this.PlayerManager.Action = ActionType.Idle; } else { this.sinceHurt += elapsed; this.PlayerManager.BlinkSpeed = Easing.EaseIn(this.sinceHurt.TotalSeconds / 1.25, EasingType.Cubic) * 1.5f; } return true; }
protected override void End() { this.fade = (ScreenFade) null; }
public void EndTrial(bool forceRestart) { if (!this.GameState.IsTrialMode) return; ScreenFade screenFade1 = new ScreenFade(ServiceHelper.Game); screenFade1.FromColor = ColorEx.TransparentBlack; screenFade1.ToColor = Color.Black; screenFade1.EaseOut = true; screenFade1.CaptureScreen = true; screenFade1.Duration = 1f; screenFade1.DrawOrder = 2050; screenFade1.WaitUntil = (Func<bool>) (() => !this.GameState.Loading); ScreenFade screenFade2 = screenFade1; screenFade2.ScreenCaptured += (Action) (() => { this.GameState.SkipLoadBackground = true; this.GameState.Loading = true; Worker<bool> worker = this.ThreadPool.Take<bool>(new Action<bool>(this.DoSellScreen)); worker.Finished += (Action) (() => { this.ThreadPool.Return<bool>(worker); this.GameState.ScheduleLoadEnd = true; this.GameState.SkipLoadBackground = false; }); worker.Start(forceRestart); }); ServiceHelper.AddComponent((IGameComponent) screenFade2); }
public void Restart() { if (this.ForcedSignOut) { this.SinceSaveRequest = -1f; this.ActiveGamerSignedOut(); } this.ForceTimePaused = true; ScreenFade screenFade1 = new ScreenFade(ServiceHelper.Game); screenFade1.FromColor = ColorEx.TransparentBlack; screenFade1.ToColor = Color.Black; screenFade1.EaseOut = true; screenFade1.CaptureScreen = true; screenFade1.Duration = 0.5f; screenFade1.WaitUntil = (Func<bool>) (() => !this.Loading); screenFade1.DrawOrder = 2050; ScreenFade screenFade2 = screenFade1; screenFade2.ScreenCaptured += (Action) (() => { this.Loading = true; Worker<bool> worker = this.ThreadPool.Take<bool>(new Action<bool>(this.DoRestart)); worker.Finished += (Action) (() => { this.ThreadPool.Return<bool>(worker); this.SkipLoadBackground = false; this.Loading = false; }); worker.Start(false); }); ServiceHelper.AddComponent((IGameComponent) screenFade2); }
public void ReturnToArcade() { ScreenFade screenFade1 = new ScreenFade(ServiceHelper.Game); screenFade1.FromColor = ColorEx.TransparentBlack; screenFade1.ToColor = Color.Black; screenFade1.Duration = 0.75f; screenFade1.EaseOut = true; screenFade1.DrawOrder = 3000; ScreenFade screenFade2; ServiceHelper.AddComponent((IGameComponent) (screenFade2 = screenFade1)); screenFade2.Faded += new Action(ServiceHelper.Game.Exit); }