public LongRunningAction ChangeLevel(string levelName, bool asDoor, bool spin, bool trialEnding) { if (asDoor) { this.PlayerManager.SpinThroughDoor = spin; this.PlayerManager.NextLevel = levelName; this.PlayerManager.DoorVolume = this.ScriptingManager.EvaluatedScript.InitiatingTrigger.Object.Identifier; this.PlayerManager.DoorEndsTrial = trialEnding && this.GameState.IsTrialMode; IGameLevelManager levelManager = this.LevelManager; int num = (levelManager.WentThroughSecretPassage ? 1 : 0) | (!this.PlayerManager.DoorVolume.HasValue || this.LevelManager.Volumes[this.PlayerManager.DoorVolume.Value].ActorSettings == null ? 0 : (this.LevelManager.Volumes[this.PlayerManager.DoorVolume.Value].ActorSettings.IsSecretPassage ? 1 : 0)); levelManager.WentThroughSecretPassage = num != 0; return(new LongRunningAction((Action)(() => { this.PlayerManager.NextLevel = (string)null; this.PlayerManager.DoorVolume = new int?(); this.PlayerManager.DoorEndsTrial = false; if (ActionTypeExtensions.IsEnteringDoor(this.PlayerManager.Action)) { return; } this.LevelManager.WentThroughSecretPassage = false; }))); } else { ServiceHelper.AddComponent((IGameComponent) new LevelTransition(ServiceHelper.Game, levelName)); return(new LongRunningAction()); } }
void CreateGameLevelManager(ISetting setting) { if (_gameLevelManager != null) { RemoveOnDeleteEventListener(_gameLevelManager); } _gameLevelManager = new GameLevelManager(setting, this); AddOnDeleteEventListener(_gameLevelManager); }
public GlitchyRespawner(Game game, TrileInstance instance, bool soundEmitter) : base(game) { this.UpdateOrder = -2; this.DrawOrder = 10; this.Instance = instance; this.EmitOrNot = soundEmitter; this.TargetRenderer = ServiceHelper.Get<ITargetRenderingManager>(); this.LightingPostProcess = ServiceHelper.Get<ILightingPostProcess>(); this.LevelMaterializer = ServiceHelper.Get<ILevelMaterializer>(); this.GameState = ServiceHelper.Get<IGameStateManager>(); this.CameraManager = ServiceHelper.Get<IDefaultCameraManager>(); this.LevelManager = ServiceHelper.Get<IGameLevelManager>(); this.CMProvider = ServiceHelper.Get<IContentManagerProvider>(); }
public GlitchyRespawner(Game game, TrileInstance instance, bool soundEmitter) : base(game) { this.UpdateOrder = -2; this.DrawOrder = 10; this.Instance = instance; this.EmitOrNot = soundEmitter; this.TargetRenderer = ServiceHelper.Get <ITargetRenderingManager>(); this.LightingPostProcess = ServiceHelper.Get <ILightingPostProcess>(); this.LevelMaterializer = ServiceHelper.Get <ILevelMaterializer>(); this.GameState = ServiceHelper.Get <IGameStateManager>(); this.CameraManager = ServiceHelper.Get <IDefaultCameraManager>(); this.LevelManager = ServiceHelper.Get <IGameLevelManager>(); this.CMProvider = ServiceHelper.Get <IContentManagerProvider>(); }
public LongRunningAction SetWaterHeight(float height) { float sign = (float)Math.Sign(height - this.LevelManager.WaterHeight); TrileInstance[] buoyantTriles = Enumerable.ToArray <TrileInstance>(Enumerable.Where <TrileInstance>((IEnumerable <TrileInstance>) this.LevelManager.Triles.Values, (Func <TrileInstance, bool>)(x => ActorTypeExtensions.IsBuoyant(x.Trile.ActorSettings.Type)))); return(new LongRunningAction((Func <float, float, bool>)((elapsed, __) => { if (this.GameState.Paused || this.GameState.InMap || (!this.CameraManager.ActionRunning || this.CameraManager.Viewpoint == Viewpoint.Perspective)) { return false; } if ((double)Math.Sign(height - this.LevelManager.WaterHeight) != (double)sign) { return true; } this.LevelManager.WaterSpeed = 1.2f * sign; IGameLevelManager temp_76 = this.LevelManager; double temp_84 = (double)temp_76.WaterHeight + (double)this.LevelManager.WaterSpeed * (double)elapsed; temp_76.WaterHeight = (float)temp_84; if (this.LevelManager.WaterType != LiquidType.Lava) { foreach (TrileInstance item_0 in buoyantTriles) { if ((double)item_0.Center.Y < (double)this.LevelManager.WaterHeight) { item_0.PhysicsState.Velocity = new Vector3(0.0f, 0.01f, 0.0f); } } } return false; }), (Action)(() => { this.LevelManager.WaterSpeed = 0.0f; if (this.LevelManager.WaterType == LiquidType.Water) { this.GameState.SaveData.GlobalWaterLevelModifier = new float?(this.LevelManager.WaterHeight - this.LevelManager.OriginalWaterHeight); } else { this.GameState.SaveData.ThisLevel.LastStableLiquidHeight = new float?(this.LevelManager.WaterHeight); } }))); }
void CreateGameLevelManager(ISetting setting) { if(_gameLevelManager != null) { RemoveOnDeleteEventListener(_gameLevelManager); } _gameLevelManager = new GameLevelManager(setting, this); AddOnDeleteEventListener(_gameLevelManager); }
public LongRunningAction RaiseWater(float unitsPerSecond, float toHeight) { float sign = (float)Math.Sign(toHeight - this.LevelManager.WaterHeight); TrileInstance[] buoyantTriles = Enumerable.ToArray <TrileInstance>(Enumerable.Where <TrileInstance>((IEnumerable <TrileInstance>) this.LevelManager.Triles.Values, (Func <TrileInstance, bool>)(x => ActorTypeExtensions.IsBuoyant(x.Trile.ActorSettings.Type)))); if ((double)this.LevelManager.WaterSpeed != 0.0) { this.waterStopStack.Push(new object()); } bool flag = false; if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.Name == "WATER_WHEEL") { if (this.sewageLevelEmitter != null && !this.sewageLevelEmitter.Dead) { this.sewageLevelEmitter.Cue.Stop(false); flag = true; } if (this.sewageLevelSound == null) { this.sewageLevelSound = this.CMProvider.Global.Load <SoundEffect>("Sounds/Sewer/SewageLevelChange"); } this.sewageLevelEmitter = SoundEffectExtensions.Emit(this.sewageLevelSound, true, !flag); if (!flag) { this.sewageLevelEmitter.VolumeFactor = 0.0f; this.sewageLevelEmitter.Cue.Play(); } } return(new LongRunningAction((Func <float, float, bool>)((elapsed, __) => { if (this.GameState.Paused || this.GameState.InMap || (this.GameState.ForceTimePaused || !this.CameraManager.ActionRunning) || this.CameraManager.Viewpoint == Viewpoint.Perspective) { return false; } if ((double)Math.Sign(toHeight - this.LevelManager.WaterHeight) != (double)sign || this.waterStopStack.Count > 0) { return true; } if (this.sewageLevelEmitter != null && !this.sewageLevelEmitter.Dead) { this.sewageLevelEmitter.VolumeFactor = FezMath.Saturate(this.sewageLevelEmitter.VolumeFactor + elapsed * 1.25f); } this.LevelManager.WaterSpeed = unitsPerSecond * sign; IGameLevelManager temp_142 = this.LevelManager; double temp_150 = (double)temp_142.WaterHeight + (double)this.LevelManager.WaterSpeed * (double)elapsed; temp_142.WaterHeight = (float)temp_150; foreach (TrileInstance item_0 in buoyantTriles) { if (!item_0.PhysicsState.Floating && item_0.PhysicsState.Static && (double)item_0.Center.Y < (double)this.LevelManager.WaterHeight - 0.5) { item_0.PhysicsState.ForceNonStatic = true; item_0.PhysicsState.Ground = new MultipleHits <TrileInstance>(); } } return false; }), (Action)(() => { this.LevelManager.WaterSpeed = 0.0f; if (this.LevelManager.WaterType == LiquidType.Water) { this.GameState.SaveData.GlobalWaterLevelModifier = new float?(this.LevelManager.WaterHeight - this.LevelManager.OriginalWaterHeight); } else { this.GameState.SaveData.ThisLevel.LastStableLiquidHeight = new float?(this.LevelManager.WaterHeight); } if (this.waterStopStack.Count == 0) { if (this.sewageLevelEmitter != null && !this.sewageLevelEmitter.Dead) { this.sewageLevelEmitter.FadeOutAndDie(0.75f); } this.sewageLevelEmitter = (SoundEmitter)null; } if (this.waterStopStack.Count <= 0) { return; } this.waterStopStack.Pop(); }))); }