protected override bool Act(TimeSpan elapsed) { int frame = this.PlayerManager.Animation.Timing.Frame; this.sinceStarted += elapsed; if (this.sinceStarted.TotalSeconds < 0.25 && !FezButtonStateExtensions.IsDown(this.InputManager.GrabThrow)) { this.eTurnAway.FadeOutAndDie(0.1f); this.reverse = true; } if (this.reverse) { this.PlayerManager.Animation.Timing.Update(elapsed, -1f); if ((double) this.PlayerManager.Animation.Timing.Step <= 0.0) this.PlayerManager.Action = ActionType.Idle; return false; } else { if (this.PlayerManager.Animation.Timing.Frame == 32 && (this.eTurnBack == null || this.eTurnBack.Dead)) this.eTurnBack = SoundEffectExtensions.EmitAt(this.sTurnBack, this.PlayerManager.Position); if (this.PlayerManager.Animation.Timing.Ended) { this.PlayerManager.Action = ActionType.Idle; return false; } else { if (frame != this.lastFrame && frame == 18) SoundEffectExtensions.EmitAt(this.sFallOnFace, this.PlayerManager.Position); this.lastFrame = frame; return true; } } }
protected override void Begin() { this.sinceStarted = TimeSpan.Zero; this.eTurnAway = SoundEffectExtensions.EmitAt(this.sTurnAway, this.PlayerManager.Position); this.reverse = false; this.lastFrame = -1; }
private void TryInitialize() { this.sRumble = (SoundEffect) null; this.eRumble = (SoundEmitter) null; this.OwlHeadAo = Enumerable.SingleOrDefault<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => { if (!(x.ArtObjectName == "OWL_STATUE_HEADAO") && !(x.ArtObjectName == "BIG_OWL_HEADAO")) return x.ArtObjectName == "OWL_STATUE_DRAPES_BAO"; else return true; })); this.AttachedCandlesAo = (ArtObjectInstance) null; this.IsBig = this.OwlHeadAo != null && this.OwlHeadAo.ArtObjectName == "BIG_OWL_HEADAO"; this.Enabled = this.OwlHeadAo != null; this.SinceStarted = 0.0f; if (!this.Enabled) return; this.sRumble = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/MiscActors/Rumble"); this.eRumble = SoundEffectExtensions.EmitAt(this.sRumble, this.OwlHeadAo.Position, true, true); this.eRumble.VolumeFactor = 0.0f; this.IsInverted = false; if (this.OwlHeadAo.ArtObjectName == "OWL_STATUE_DRAPES_BAO") { this.AttachedCandlesAo = this.LevelManager.ArtObjects[14]; this.OriginalRotation = Quaternion.Identity; this.IsInverted = true; } else this.OriginalRotation = this.OwlHeadAo.Rotation * Quaternion.CreateFromAxisAngle(Vector3.Up, FezMath.ToPhi(this.CameraManager.Viewpoint)); this.OriginalTranslation = this.OwlHeadAo.Position; }
public override void Initialize() { base.Initialize(); this.movementHelper.Entity = (IPhysicsEntity) this.PlayerManager; this.LevelManager.LevelChanged += (Action) (() => { if (this.LevelManager.WaterType == LiquidType.None) return; this.treadInstance = SoundEffectExtensions.Emit(this.CMProvider.Global.Load<SoundEffect>("Sounds/Gomez/Tread"), true, true); }); }
public override void Initialize() { base.Initialize(); this.GameState.InCutscene = false; this.GameState.ForceTimePaused = true; this.PlayerManager.CanControl = false; this.Destination = this.CameraManager.Center; this.RecalculateOrigin(); this.CameraManager.Center = this.Origin; if (this.CameraManager.Constrained) this.FirstConstraint = true; this.SoundManager.PlayNewAmbience(); this.ePanDown = SoundEffectExtensions.Emit(this.CMProvider.Get(CM.Intro).Load<SoundEffect>("Sounds/Intro/PanDown"), true, true); }
private void TryInitialize() { this.OpenSplash = this.OpeningSplash = this.OpenWaterfall = this.OpeningWaterfall = (AnimatedTexture) null; this.sWaterfallOpening = (SoundEffect) null; this.eWaterfallClosed = (SoundEmitter) null; this.eWaterfallOpen = (SoundEmitter) null; this.WaterfallPlane = Enumerable.FirstOrDefault<BackgroundPlane>((IEnumerable<BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func<BackgroundPlane, bool>) (x => x.ActorType == ActorType.BigWaterfall)); this.Enabled = this.WaterfallPlane != null; if (!this.Enabled) return; this.MoriaPlane = Enumerable.FirstOrDefault<BackgroundPlane>((IEnumerable<BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func<BackgroundPlane, bool>) (x => x.TextureName == "MORIA_GLOW")); if (this.GameState.SaveData.ThisLevel.InactiveGroups.Contains(1) || this.GameState.SaveData.ThisLevel.InactiveVolumes.Contains(19)) this.MoriaPlane.Opacity = 0.0f; this.MoriaPlane.Position -= Vector3.UnitX * (1.0 / 1000.0); Comparison<Group> oldGo = this.LevelMaterializer.StaticPlanesMesh.GroupOrder; this.LevelMaterializer.StaticPlanesMesh.GroupOrder = (Comparison<Group>) ((x, y) => { if (x == this.MoriaPlane.Group) return 1; if (y != this.MoriaPlane.Group) return oldGo(x, y); else return -1; }); bool flag = this.GameState.SaveData.ThisLevel.ScriptingState == "WATERFALL_OPEN"; if (flag) { this.OpenSplash = this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_splash_open"); this.OpenWaterfall = this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_open"); Waiters.Wait((Func<bool>) (() => !this.GameState.Loading), (Action) (() => this.LevelManager.Volumes[7].Enabled = true)); } else this.ForkLoad(false); this.SplashPlane = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, flag ? this.OpenSplash : this.CMProvider.CurrentLevel.Load<AnimatedTexture>("Background Planes/water_giant_splash")) { Doublesided = true }; this.LevelManager.AddPlane(this.SplashPlane); this.Top = FezMath.Dot(this.WaterfallPlane.Position + this.WaterfallPlane.Scale * this.WaterfallPlane.Size / 2f, Vector3.UnitY); this.TerminalPosition = this.WaterfallPlane.Position - this.WaterfallPlane.Scale * this.WaterfallPlane.Size / 2f * Vector3.UnitY + Vector3.Transform(Vector3.UnitZ, this.WaterfallPlane.Rotation) / 16f; this.sinceAlive = 0.0f; if (flag) { this.SwapOpened(); this.eWaterfallOpen = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/MiscActors/BigWaterfallOpen"), this.WaterfallPlane.Position, true, 0.0f, 0.0f); } else this.eWaterfallClosed = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/MiscActors/BigWaterfallClosed"), this.WaterfallPlane.Position, true, 0.0f, 0.0f); }
protected override void Begin() { base.Begin(); if (this.eCratePush == null || this.eCratePush.Dead) this.eCratePush = SoundEffectExtensions.EmitAt(this.sCratePush, this.PlayerManager.PushedInstance.Center, true); else this.eCratePush.Cue.Resume(); if (this.eGomezPush == null || this.eGomezPush.Dead) this.eGomezPush = SoundEffectExtensions.EmitAt(this.sGomezPush, this.PlayerManager.Position, true); else this.eGomezPush.Cue.Resume(); if (this.LevelManager.PickupGroups.TryGetValue(this.PlayerManager.PushedInstance, out this.pickupGroup)) return; this.pickupGroup = (TrileGroup) null; }
protected override bool Act(TimeSpan elapsed) { int frame = this.PlayerManager.Animation.Timing.Frame; if (this.lastFrame != frame) { if (frame == 0) this.eLast = SoundEffectExtensions.EmitAt(this.sBegin, this.PlayerManager.Position); else if (frame == 6) this.eLast = SoundEffectExtensions.EmitAt(this.sMouthOpen, this.PlayerManager.Position); else if (frame == 9) this.eLast = SoundEffectExtensions.EmitAt(this.sMouthClose, this.PlayerManager.Position); } this.lastFrame = frame; if (this.eLast != null && !this.eLast.Dead) this.eLast.Position = this.PlayerManager.Position; return true; }
public override void Update(GameTime gameTime) { if (this.GameState.Loading) return; if (FezMath.AlmostEqual(this.PlayerManager.Velocity.Y, 0.0f)) { if (this.eFall != null && !this.eFall.Dead) { this.eFall.FadeOutAndDie(0.1f); this.eFall = (SoundEmitter) null; } } else { if (this.eFall == null || this.eFall.Dead) this.eFall = SoundEffectExtensions.EmitAt(this.sFall, this.PlayerManager.Position, true, 0.0f, 0.0f); this.eFall.Position = this.PlayerManager.Position; this.eFall.VolumeFactor = Easing.EaseIn((double) FezMath.Saturate((float) (-(double) this.PlayerManager.Velocity.Y / 0.400000005960464)), EasingType.Quadratic); } base.Update(gameTime); }
public override void Update(GameTime gameTime) { if (this.GameState.Loading || this.GameState.Paused) return; float elapsed = (float) gameTime.ElapsedGameTime.TotalSeconds; if ((double) elapsed == 0.0 || (double) this.StepTime == 0.0) { this.Reset(); SoundEffectExtensions.Emit(this.sAppear); } this.StepTime += elapsed; if ((double) this.CameraManager.Radius < 11000.0) { IGameCameraManager cameraManager = this.CameraManager; double num = (double) cameraManager.Radius * 1.00625002384186; cameraManager.Radius = (float) num; this.CameraManager.SnapInterpolation(); } if (!this.sMovePlayed && (double) this.StepTime >= 4.0) { SoundEffectExtensions.Emit(this.sStartMove); this.sMovePlayed = true; } if (!this.sProgPlayed && (double) this.StepTime >= 14.0) { SoundEffectExtensions.Emit(this.sProgressiveAppear); this.sProgPlayed = true; } if ((double) this.StepTime >= 29.0) { if (this.eNoise == null) this.eNoise = SoundEffectExtensions.Emit(this.sNoise, true, 0.0f, 0.0f); this.eNoise.VolumeFactor = FezMath.Saturate((float) (((double) this.StepTime - 29.0) / 7.0)); } if ((double) this.StepTime < 33.0) { this.UpdateDot(elapsed); float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice); if ((double) this.CameraManager.Radius >= 500.0) { float radius = this.CameraManager.Radius; this.CameraManager.Radius = 600f * viewScale; this.CameraManager.SnapInterpolation(); this.GraphicsDevice.SetRenderTarget(this.RtHandle.Target); this.GraphicsDevice.Clear(ColorEx.TransparentWhite); this.DrawDot(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); this.CloneMesh.Texture = (Dirtyable<Texture>) ((Texture) this.RtHandle.Target); this.CameraManager.Radius = radius; this.CameraManager.SnapInterpolation(); } } if ((double) this.StepTime <= 36.0) return; this.ChangeState(); }
private void Reset() { this.CameraManager.Center = Vector3.Zero; this.CameraManager.Direction = Vector3.UnitZ; this.CameraManager.Radius = 1.0 / 16.0; this.CameraManager.SnapInterpolation(); this.DotMesh.Position = Vector3.Zero; this.DotMesh.Scale = Vector3.One; this.sMovePlayed = this.sProgPlayed = false; if (this.eNoise != null && !this.eNoise.Dead) this.eNoise.FadeOutAndDie(0.0f); this.eNoise = (SoundEmitter) null; this.StepTime = 0.0f; this.Theta = 0.0f; }
public ValveState(ValvesBoltsTimeswitchesHost host, ArtObjectInstance ao) { ServiceHelper.InjectServices((object) this); this.Host = host; this.ArtObject = ao; this.IsBolt = this.ArtObject.ArtObject.ActorType == ActorType.BoltHandle; this.IsTimeswitch = this.ArtObject.ArtObject.ActorType == ActorType.Timeswitch; BoundingBox boundingBox = new BoundingBox(this.ArtObject.Position - this.ArtObject.ArtObject.Size / 2f, this.ArtObject.Position + this.ArtObject.ArtObject.Size / 2f); if (this.ArtObject.ActorSettings.AttachedGroup.HasValue) this.AttachedGroup = this.LevelManager.Groups[this.ArtObject.ActorSettings.AttachedGroup.Value]; if (this.IsTimeswitch) { this.eTimeswitchWindBack = SoundEffectExtensions.EmitAt(this.Host.TimeswitchWindBackSound, ao.Position, true, true); foreach (ArtObjectInstance artObjectInstance in (IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values) { if (artObjectInstance != ao && artObjectInstance.ArtObject.ActorType == ActorType.TimeswitchMovingPart) { BoundingBox box = new BoundingBox(artObjectInstance.Position - artObjectInstance.ArtObject.Size / 2f, artObjectInstance.Position + artObjectInstance.ArtObject.Size / 2f); if (boundingBox.Intersects(box)) { this.TimeswitchScrewAo = artObjectInstance; break; } } } } int num1; if (!this.IsBolt && !this.IsTimeswitch && (this.GameState.SaveData.ThisLevel.PivotRotations.TryGetValue(this.ArtObject.Id, out num1) && num1 != 0)) { int num2 = Math.Abs(num1); int num3 = Math.Sign(num1); for (int index = 0; index < num2; ++index) this.ArtObject.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.UnitY, 1.570796f * (float) num3); } if (this.IsBolt) { foreach (TrileInstance instance in this.AttachedGroup.Triles) instance.PhysicsState = new InstancePhysicsState(instance); } foreach (Volume volume in (IEnumerable<Volume>) this.LevelManager.Volumes.Values) { Vector3 vector3 = FezMath.Abs(volume.To - volume.From); if ((double) vector3.X == 3.0 && (double) vector3.Z == 3.0 && ((double) vector3.Y == 1.0 && boundingBox.Contains(volume.BoundingBox) == ContainmentType.Contains)) { this.CenterOffset = (volume.From + volume.To) / 2f - this.ArtObject.Position; break; } } }
public override void Update(GameTime gameTime) { if (this.GameState.Loading || this.GameState.InMap || (this.PointsList.Length == 0 || this.Dot.PreventPoI) || (this.GameState.Paused || this.GameState.InMenuCube || this.Dot.Owner != null && this.Dot.Owner != this) || (this.GameState.FarawaySettings.InTransition || ActionTypeExtensions.IsEnteringDoor(this.PlayerManager.Action))) return; Vector3 vector3 = FezMath.DepthMask(this.CameraManager.Viewpoint); BoundingBox boundingBox1 = new BoundingBox(this.PlayerManager.Center - new Vector3(6f), this.PlayerManager.Center + new Vector3(6f)); Volume volume1 = (Volume) null; foreach (Volume volume2 in this.PointsList) { if (volume2.Enabled) { BoundingBox boundingBox2 = volume2.BoundingBox; boundingBox2.Min -= vector3 * 1000f; boundingBox2.Max += vector3 * 1000f; if (boundingBox1.Contains(boundingBox2) != ContainmentType.Disjoint) { this.Dot.ComeOut(); this.Dot.Behaviour = DotHost.BehaviourType.RoamInVolume; this.Dot.RoamingVolume = volume1 = volume2; } if (this.SpeechBubble.Hidden) { if (this.talkWaiter != null && this.talkWaiter.Alive) this.talkWaiter.Cancel(); if (this.eDotTalk != null && !this.eDotTalk.Dead) this.eDotTalk.FadeOutAndPause(0.1f); } if (!this.SpeechBubble.Hidden && this.PlayerManager.CurrentVolumes.Contains(volume2) && volume2.ActorSettings.DotDialogue.Count > 0 && (this.PlayerManager.Action == ActionType.Suffering || this.PlayerManager.Action == ActionType.SuckedIn || (this.PlayerManager.Action == ActionType.LesserWarp || this.PlayerManager.Action == ActionType.GateWarp))) { this.SpeechBubble.Hide(); this.Dot.Behaviour = DotHost.BehaviourType.ReadyToTalk; this.InGroup = false; } if (!this.GameState.InFpsMode && this.PlayerManager.CurrentVolumes.Contains(volume2) && volume2.ActorSettings.DotDialogue.Count > 0) { if (this.SpeechBubble.Hidden && (this.InputManager.CancelTalk == FezButtonState.Pressed || this.InGroup)) { switch (this.PlayerManager.Action) { case ActionType.Sliding: case ActionType.Landing: case ActionType.IdlePlay: case ActionType.IdleSleep: case ActionType.IdleLookAround: case ActionType.IdleYawn: case ActionType.Idle: case ActionType.Walking: case ActionType.Running: volume2.ActorSettings.NextLine = (volume2.ActorSettings.NextLine + 1) % volume2.ActorSettings.DotDialogue.Count; int index1 = (volume2.ActorSettings.NextLine + 1) % volume2.ActorSettings.DotDialogue.Count; this.InGroup = volume2.ActorSettings.DotDialogue[volume2.ActorSettings.NextLine].Grouped && volume2.ActorSettings.DotDialogue[index1].Grouped && index1 != 0; volume2.ActorSettings.PreventHey = true; string index2 = volume2.ActorSettings.DotDialogue[volume2.ActorSettings.NextLine].ResourceText; bool flag; if (this.GameState.SaveData.OneTimeTutorials.TryGetValue(index2, out flag) && !flag) { this.GameState.SaveData.OneTimeTutorials[index2] = true; this.SyncTutorials(); } if (this.talkWaiter != null && this.talkWaiter.Alive) this.talkWaiter.Cancel(); string @string = GameText.GetString(index2); this.SpeechBubble.ChangeText(@string); this.PlayerManager.Action = ActionType.ReadingSign; if (this.eDotTalk == null || this.eDotTalk.Dead) { this.eDotTalk = SoundEffectExtensions.EmitAt(this.sDotTalk, this.Dot.Position, true); } else { this.eDotTalk.Position = this.Dot.Position; Waiters.Wait(0.100000001490116, (Action) (() => { this.eDotTalk.Cue.Resume(); this.eDotTalk.VolumeFactor = 1f; })).AutoPause = true; } this.talkWaiter = Waiters.Wait(0.100000001490116 + 0.0750000029802322 * (double) Util.StripPunctuation(@string).Length * (Culture.IsCJK ? 2.0 : 1.0), (Action) (() => { if (this.eDotTalk == null) return; this.eDotTalk.FadeOutAndPause(0.1f); })); this.talkWaiter.AutoPause = true; break; } } if (this.SpeechBubble.Hidden && !volume2.ActorSettings.PreventHey) { if (this.PlayerManager.Grounded) { switch (this.PlayerManager.Action) { case ActionType.Sliding: case ActionType.Landing: case ActionType.IdlePlay: case ActionType.IdleSleep: case ActionType.IdleLookAround: case ActionType.IdleYawn: case ActionType.Idle: case ActionType.Walking: case ActionType.Running: this.Dot.Behaviour = DotHost.BehaviourType.ThoughtBubble; this.Dot.FaceButton = DotFaceButton.B; if (this.Dot.Owner != this) this.Dot.Hey(); this.Dot.Owner = (object) this; break; default: this.Dot.Behaviour = DotHost.BehaviourType.ReadyToTalk; break; } } } else this.Dot.Behaviour = DotHost.BehaviourType.ReadyToTalk; if (!this.SpeechBubble.Hidden) this.SpeechBubble.Origin = this.Dot.Position; if (this.Dot.Behaviour == DotHost.BehaviourType.ReadyToTalk || this.Dot.Behaviour == DotHost.BehaviourType.ThoughtBubble) break; } } } if (this.Dot.Behaviour != DotHost.BehaviourType.ThoughtBubble && this.Dot.Owner == this && this.SpeechBubble.Hidden) this.Dot.Owner = (object) null; if (volume1 != null || this.Dot.RoamingVolume == null) return; this.Dot.Burrow(); }
public override void Draw(GameTime gameTime) { if (this.GameState.Loading) return; TimeSpan elapsedGameTime = gameTime.ElapsedGameTime; if (!this.GameState.Paused && FezMath.IsOrthographic(this.CameraManager.Viewpoint) && (this.CameraManager.ActionRunning && !this.GameState.InMap)) { this.flashIn -= elapsedGameTime; this.distantIn -= elapsedGameTime; } if (!this.doThunder) return; if (this.distantIn.Ticks <= 0L) { this.distantIn = TimeSpan.FromSeconds((double) RandomHelper.Between(3.0, 6.0)); SoundEffectExtensions.EmitAt(RandomHelper.InList<SoundEffect>(this.thunderDistant), this.CameraManager.Center + this.LevelManager.Size / 2f * FezMath.ForwardVector(this.CameraManager.Viewpoint) + (float) ((double) RandomHelper.Centered(1.0) * (double) this.CameraManager.Radius * 0.5) * FezMath.RightVector(this.CameraManager.Viewpoint) + this.CameraManager.Center * Vector3.UnitY, RandomHelper.Centered(0.0500000007450581), RandomHelper.Between(0.75, 1.0)).NoAttenuation = true; } if (this.flashIn.Ticks <= 0L) { this.flashes = RandomHelper.Random.Next(1, 3); this.sinceFlash = TimeSpan.FromSeconds(-0.200000002980232); this.flashSpeed = RandomHelper.Between(1.5, 3.5); this.flashOpacity = RandomHelper.Between(0.2, 0.4); this.flashIn = TimeSpan.FromSeconds((double) RandomHelper.Between(4.0, 6.0)); this.lightning.Rotation = this.CameraManager.Rotation; this.lightningSideOffset = RandomHelper.Centered(1.0); this.lightning.Position = this.CameraManager.Center + this.LevelManager.Size / 2f * FezMath.ForwardVector(this.CameraManager.Viewpoint) + (float) ((double) this.lightningSideOffset * (double) this.CameraManager.Radius * 0.5) * FezMath.RightVector(this.CameraManager.Viewpoint) + RandomHelper.Centered(10.0) * Vector3.UnitY; if (this.ePreThunder != null) { this.ePreThunder.Cue.Stop(false); this.ePreThunder = (SoundEmitter) null; } (this.ePreThunder = SoundEffectExtensions.EmitAt(this.sPreThunder, this.lightning.Position * FezMath.XZMask + this.CameraManager.Center * Vector3.UnitY, RandomHelper.Centered(0.025000000372529))).NoAttenuation = true; } if (this.sinceFlash.TotalSeconds < 0.200000002980232) { float alpha = Easing.EaseOut((double) FezMath.Saturate(1f - (float) (this.sinceFlash.TotalSeconds / 0.200000002980232)), EasingType.Quadratic) * this.flashOpacity; GraphicsDeviceExtensions.SetBlendingMode(this.GraphicsDevice, BlendingMode.Alphablending); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.Sky); this.ImmediateRenderer.DrawFullscreen(new Color(1f, 1f, 1f, alpha)); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.Trails); this.ImmediateRenderer.DrawFullscreen(new Color(1f, 1f, 1f, alpha)); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.SkyLayer1); this.ImmediateRenderer.DrawFullscreen(new Color(0.9f, 0.9f, 0.9f, alpha)); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.SkyLayer2); this.ImmediateRenderer.DrawFullscreen(new Color(0.8f, 0.8f, 0.8f, alpha)); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.SkyLayer3); this.ImmediateRenderer.DrawFullscreen(new Color(0.7f, 0.7f, 0.7f, alpha)); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Less, StencilMask.SkyLayer3); this.ImmediateRenderer.DrawFullscreen(new Color(0.0f, 0.0f, 0.0f, alpha)); this.sinceFlash += TimeSpan.FromTicks((long) ((double) elapsedGameTime.Ticks * (double) this.flashSpeed)); if (this.flashes == 1 && (double) alpha / (double) this.flashOpacity < 0.5) { this.lightning.Material.Opacity = 1f; GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.NotEqual, StencilMask.SkyLayer3); this.lightning.Draw(); } else if (this.flashes == 0 && this.sinceFlash.Ticks < 0L) { this.lightning.Material.Opacity = (float) (this.sinceFlash.TotalSeconds / -0.200000002980232); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.NotEqual, StencilMask.SkyLayer3); this.lightning.Draw(); } GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.None)); } if (this.sinceFlash.TotalSeconds <= 0.200000002980232 || this.flashes == 0) return; --this.flashes; this.sinceFlash = TimeSpan.FromSeconds(-0.200000002980232); this.flashSpeed = this.flashes == 0 ? 1f : RandomHelper.Between(2.0, 4.0); this.flashOpacity = this.flashes == 0 ? 1f : RandomHelper.Between(0.2, 0.4); if (this.flashes != 0) return; if (this.ePreThunder != null && !this.ePreThunder.Dead) this.ePreThunder.Cue.Stop(false); this.ePreThunder = (SoundEmitter) null; SoundEmitter emitter = SoundEffectExtensions.EmitAt(RandomHelper.InList<SoundEffect>(this.lightningSounds), this.lightning.Position * FezMath.XZMask + this.CameraManager.Center * Vector3.UnitY, RandomHelper.Centered(0.025000000372529)); emitter.NoAttenuation = true; emitter.Persistent = true; Waiters.DoUntil((Func<bool>) (() => emitter.Dead), (Action<float>) (_ => emitter.Position = Vector3.Lerp(emitter.Position, this.CameraManager.Center, 0.025f))).AutoPause = true; }
private void TryInitialize() { if (this.eIdleSpin != null && this.eIdleSpin.Cue != null && (!this.eIdleSpin.Cue.IsDisposed && this.eIdleSpin.Cue.State != SoundState.Stopped)) this.eIdleSpin.Cue.Stop(false); this.eIdleSpin = (SoundEmitter) null; this.rgbPlanes = (Mesh) null; this.particles = (PlaneParticleSystem) null; this.Phase = LesserWarp.Phases.None; this.sinceInitialized = 0.0f; this.GateAo = Enumerable.FirstOrDefault<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObject.ActorType == ActorType.LesserGate)); if (this.GateAo == null) return; this.InitializeRgbGate(); LesserWarp lesserWarp = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.Textured textured1 = new DefaultEffect.Textured(); textured1.Fullbright = true; DefaultEffect.Textured textured2 = textured1; mesh2.Effect = (BaseEffect) textured2; mesh1.DepthWrites = false; mesh1.Texture = (Dirtyable<Texture>) ((Texture) this.WhiteTexture); mesh1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, -1.570796f); Mesh mesh3 = mesh1; lesserWarp.MaskMesh = mesh3; this.MaskMesh.AddFace(new Vector3(2f), Vector3.Zero, FaceOrientation.Front, true, true); this.MaskMesh.BakeTransformWithNormal<FezVertexPositionNormalTexture>(); this.MaskMesh.Position = this.GateAo.Position - Vector3.UnitY * 1.25f; this.HasCubeShard = Enumerable.Any<TrileInstance>((IEnumerable<TrileInstance>) this.LevelManager.Triles.Values, (Func<TrileInstance, bool>) (x => { if (ActorTypeExtensions.IsCubeShard(x.Trile.ActorSettings.Type)) return (double) Vector3.Distance(x.Center, this.GateAo.Position) < 3.0; else return false; })); this.OriginalPosition = this.GateAo.Position; this.sRise = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpRise"); this.sLower = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpLower"); this.sActivate = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/WarpGateActivate"); this.eIdleSpin = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpIdleSpin"), this.GateAo.Position, true, true); }
public override void Update(GameTime gameTime) { if (this.GameState.Paused || this.GameState.InMap || (!this.CameraManager.ActionRunning || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)) || (this.GameState.Loading || this.TrackedSuckBlocks.Count == 0)) return; FaceOrientation visibleOrientation = this.CameraManager.VisibleOrientation; Vector3 vector3_1 = FezMath.ForwardVector(this.CameraManager.Viewpoint); Vector3 vector3_2 = FezMath.DepthMask(this.CameraManager.Viewpoint); Vector3 vector3_3 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); Vector3 vector3_4 = vector3_3 / 2f; bool flag1 = false; foreach (SuckBlocksHost.SuckBlockState suckBlockState in this.TrackedSuckBlocks) { TrileInstance instance = suckBlockState.Instance; if (this.PlayerManager.HeldInstance != instance) { int num1 = instance.ActorSettings.HostVolume.Value; Vector3 vector3_5 = instance.Center * (Vector3.One - vector3_2) + this.CameraManager.Position * vector3_2; this.cornerRays[0] = new Ray() { Position = vector3_5 + vector3_4 * new Vector3(1f, 0.499f, 1f), Direction = vector3_1 }; this.cornerRays[1] = new Ray() { Position = vector3_5 + vector3_4 * new Vector3(1f, -1f, 1f), Direction = vector3_1 }; this.cornerRays[2] = new Ray() { Position = vector3_5 + vector3_4 * new Vector3(-1f, 0.499f, -1f), Direction = vector3_1 }; this.cornerRays[3] = new Ray() { Position = vector3_5 + vector3_4 * new Vector3(-1f, -1f, -1f), Direction = vector3_1 }; suckBlockState.Update(gameTime.ElapsedGameTime); this.eCratePush.Position = instance.Center; bool flag2 = false; foreach (Volume volume in this.HostingVolumes) { if (volume.Orientations.Contains(visibleOrientation)) { bool flag3 = false; foreach (Ray ray in this.cornerRays) flag3 = flag3 | volume.BoundingBox.Intersects(ray).HasValue; if (flag3) { flag2 = true; if (suckBlockState.Action == SuckBlocksHost.SuckBlockAction.Sucking && (this.eSuck == null || this.eSuck.Dead)) this.eSuck = SoundEffectExtensions.EmitAt(this.sSuck, instance.Center, true); flag1 = ((flag1 ? 1 : 0) | (suckBlockState.Action == SuckBlocksHost.SuckBlockAction.Sucking ? 1 : (suckBlockState.Action == SuckBlocksHost.SuckBlockAction.Processing ? 1 : 0))) != 0; Vector3 vector3_6 = (volume.BoundingBox.Min + volume.BoundingBox.Max) / 2f; Vector3 vector3_7 = (vector3_6 - instance.Center) * vector3_3; float num2 = vector3_7.Length(); if ((double) num2 < 0.00999999977648258) { if (suckBlockState.Action == SuckBlocksHost.SuckBlockAction.Sucking) { suckBlockState.Action = SuckBlocksHost.SuckBlockAction.Processing; this.PlayerManager.CanRotate = false; this.eCratePush.VolumeFactor = 0.5f; this.eCratePush.Cue.Pitch = -0.4f; } if (suckBlockState.Action == SuckBlocksHost.SuckBlockAction.Processing) { Vector3 vector3_8 = (volume.BoundingBox.Max - volume.BoundingBox.Min) / 2f; Vector3 vector3_9 = volume.BoundingBox.Min * vector3_3 + vector3_6 * vector3_2 + vector3_8 * vector3_1 - vector3_1 * 0.5f - vector3_2 * 0.5f; Vector3 vector3_10 = vector3_9 - vector3_1; instance.Position = Vector3.Lerp(vector3_10, vector3_9, (float) suckBlockState.SinceActionChanged.Ticks / (float) SuckBlocksHost.SuckBlockState.ProcessingTime.Ticks); this.LevelManager.UpdateInstance(instance); if (suckBlockState.SinceActionChanged > SuckBlocksHost.SuckBlockState.ProcessingTime) { this.PlayerManager.CanRotate = true; if (volume.Id == num1) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type SuckBlocksHost.\u003C\u003Ec__DisplayClassb cDisplayClassb = new SuckBlocksHost.\u003C\u003Ec__DisplayClassb(); SuckBlocksHost.DisableTrile(instance); suckBlockState.Action = SuckBlocksHost.SuckBlockAction.Accepted; if (this.eCratePush.Cue.State != SoundState.Paused) this.eCratePush.Cue.Pause(); this.SuckBlockService.OnSuck(suckBlockState.Group.Id); SoundEffectExtensions.Emit(this.sAccept[4 - this.TrackedSuckBlocks.Count]); Texture2D texture2D = this.CMProvider.CurrentLevel.Load<Texture2D>("Other Textures/suck_blocks/four_highlight_" + instance.Trile.CubemapPath.Substring(instance.Trile.CubemapPath.Length - 1).ToLower(CultureInfo.InvariantCulture)); // ISSUE: reference to a compiler-generated field cDisplayClassb.plane = new BackgroundPlane(this.LevelMaterializer.StaticPlanesMesh, (Texture) texture2D) { Position = instance.Center + FezMath.AsVector(visibleOrientation) * (17.0 / 32.0), Rotation = this.CameraManager.Rotation, Doublesided = true, Fullbright = true, Opacity = 0.0f }; // ISSUE: reference to a compiler-generated field this.highlightPlanes.Add(cDisplayClassb.plane); // ISSUE: reference to a compiler-generated field this.LevelManager.AddPlane(cDisplayClassb.plane); // ISSUE: reference to a compiler-generated method Waiters.Interpolate(1.0, new Action<float>(cDisplayClassb.\u003CUpdate\u003Eb__6)); if (this.TrackedSuckBlocks.Count == 1) { Waiters.Wait(2.0, (Action) (() => Waiters.Interpolate(1.0, (Action<float>) (s => { foreach (BackgroundPlane item_3 in this.highlightPlanes) item_3.Opacity = 1f - s; }), (Action) (() => this.eSuck = (SoundEmitter) null)))); this.eSuck.FadeOutAndDie(1f); } } else suckBlockState.Action = SuckBlocksHost.SuckBlockAction.Rejected; } } if (suckBlockState.Action == SuckBlocksHost.SuckBlockAction.Rejected && FezMath.XZ(instance.PhysicsState.Velocity) == Vector2.Zero) { int num3 = RandomHelper.Probability(0.5) ? -1 : 1; Vector3 vector3_8 = new Vector3((float) num3, 0.75f, (float) num3) * vector3_3; ServiceHelper.AddComponent((IGameComponent) new CamShake(this.Game) { Distance = 0.1f, Duration = TimeSpan.FromSeconds(0.25) }); SoundEffectExtensions.Emit(this.sDenied); if (this.eCratePush.Cue.State != SoundState.Paused) this.eCratePush.Cue.Pause(); instance.PhysicsState.Velocity += 6f * vector3_8 * (float) gameTime.ElapsedGameTime.TotalSeconds; } } else if (suckBlockState.Action != SuckBlocksHost.SuckBlockAction.Rejected) { if (instance.PhysicsState.Grounded && this.eCratePush.Cue.State != SoundState.Playing) { this.eCratePush.Cue.Pitch = 0.0f; this.eCratePush.Cue.Resume(); } else if (!instance.PhysicsState.Grounded && this.eCratePush.Cue.State != SoundState.Paused) this.eCratePush.Cue.Pause(); if (this.eCratePush.Cue.State == SoundState.Playing) this.eCratePush.VolumeFactor = FezMath.Saturate(Math.Abs(FezMath.Dot(instance.PhysicsState.Velocity, FezMath.XZMask) / 0.1f)); suckBlockState.Action = SuckBlocksHost.SuckBlockAction.Sucking; instance.PhysicsState.Velocity += 0.25f * vector3_7 / num2 * (float) gameTime.ElapsedGameTime.TotalSeconds; } } } } if (!flag2) suckBlockState.Action = SuckBlocksHost.SuckBlockAction.Idle; } } if (!flag1 && this.eSuck != null && !this.eSuck.Dead) { this.eSuck.FadeOutAndDie(0.1f); this.eSuck = (SoundEmitter) null; } for (int index = 0; index < this.TrackedSuckBlocks.Count; ++index) { if (this.TrackedSuckBlocks[index].Action == SuckBlocksHost.SuckBlockAction.Accepted) { this.TrackedSuckBlocks.RemoveAt(index); --index; } } }
protected override void Dispose(bool disposing) { if (this.oldTextureCache != null) { this.AoInstance.ArtObject.Cubemap = this.oldTextureCache; new ArtObjectMaterializer(this.AoInstance.ArtObject).RecomputeTexCoords(true); } this.LevelManager.ArtObjects.Remove(this.AoInstance.Id); this.AoInstance.SoftDispose(); this.GameState.SkyOpacity = 1f; this.PlayerManager.CanControl = true; if (this.InRtHandle != null) { this.TargetRenderingManager.UnscheduleHook(this.InRtHandle.Target); this.TargetRenderingManager.ReturnTarget(this.InRtHandle); } this.InRtHandle = (RenderTargetHandle) null; if (this.OutRtHandle != null) { this.TargetRenderingManager.UnscheduleHook(this.OutRtHandle.Target); this.TargetRenderingManager.ReturnTarget(this.OutRtHandle); } this.OutRtHandle = (RenderTargetHandle) null; this.HidingPlanes.Dispose(); this.GoldenCubes.Dispose(); this.AntiCubes.Dispose(); this.TomePages.Dispose(); this.Maps.Dispose(); this.Highlights.Dispose(); this.BlurEffect.Dispose(); if (this.eBackground != null && !this.eBackground.Dead) { this.eBackground.FadeOutAndDie(0.25f, false); this.eBackground = (SoundEmitter) null; } this.GameService.CloseScroll((string) null); if (!this.wasLowPass) this.SoundManager.FadeFrequencies(false); MenuCube.Instance = (MenuCube) null; base.Dispose(disposing); }
public override void Initialize() { base.Initialize(); this.GameState.MenuCubeIsZoomed = false; this.PlayerManager.CanControl = false; ArtObject artObject = this.CMProvider.Global.Load<ArtObject>("Art Objects/MENU_CUBEAO"); bool flag = true; if (this.LevelManager.WaterType == LiquidType.Sewer) { this.oldTextureCache = artObject.Cubemap; artObject.Cubemap = this.CMProvider.Global.Load<Texture2D>("Art Objects/MENU_CUBE_GB"); } else if (this.LevelManager.WaterType == LiquidType.Lava) { this.oldTextureCache = artObject.Cubemap; artObject.Cubemap = this.CMProvider.Global.Load<Texture2D>("Art Objects/MENU_CUBE_VIRTUAL"); } else if (this.LevelManager.BlinkingAlpha) { this.oldTextureCache = artObject.Cubemap; artObject.Cubemap = this.CMProvider.Global.Load<Texture2D>("Art Objects/MENU_CUBE_CMY"); } else flag = false; if (flag) new ArtObjectMaterializer(artObject).RecomputeTexCoords(false); int key = IdentifierPool.FirstAvailable<ArtObjectInstance>(this.LevelManager.ArtObjects); this.AoInstance = new ArtObjectInstance(artObject) { Id = key, Position = this.PlayerManager.Center }; this.AoInstance.Initialize(); this.AoInstance.Material = new Material(); this.LevelManager.ArtObjects.Add(key, this.AoInstance); this.AoInstance.Scale = new Vector3(0.0f); this.OriginalViewpoint = this.CameraManager.Viewpoint; this.OriginalCenter = this.CameraManager.Center; this.OriginalPixPerTrix = this.CameraManager.PixelsPerTrixel; this.OriginalRotation = FezMath.QuaternionFromPhi(FezMath.ToPhi(this.CameraManager.Viewpoint)); RenderTarget2D renderTarget = this.GraphicsDevice.GetRenderTargets().Length == 0 ? (RenderTarget2D) null : this.GraphicsDevice.GetRenderTargets()[0].RenderTarget as RenderTarget2D; this.FillInPlanes(); this.CreateGoldenCubeFace(); this.CreateMapsFace(); this.CreateArtifactsFace(); this.CreateAntiCubeFace(); this.CreateHighlights(); this.CreateTomePages(); this.GraphicsDevice.SetRenderTarget(renderTarget); this.AntiCubes.Position = this.Maps.Position = this.HidingPlanes.Position = this.GoldenCubes.Position = this.AoInstance.Position; this.AntiCubes.Scale = this.Maps.Scale = this.HidingPlanes.Scale = this.GoldenCubes.Scale = this.AoInstance.Scale = new Vector3(0.0f); this.TransformArtifacts(); this.BlurEffect = new FastBlurEffect(); this.enterSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/EnterMenucubeOrMap"); this.exitSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/ExitMenucubeOrMap"); this.zoomInSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/ZoomIn"); this.zoomOutSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/ZoomOut"); this.rotateLeftSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/RotateLeft"); this.rotateRightSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/RotateRight"); this.cursorSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/MoveCursorMenucube"); this.sBackground = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/MenuCubeBackground"); this.eBackground = SoundEffectExtensions.Emit(this.sBackground, true); SoundEffectExtensions.Emit(this.enterSound); this.AoVisibility = new List<bool>(); this.AoInstance.Hidden = true; this.AoInstance.Visible = false; this.GameService.CloseScroll((string) null); this.GameState.ShowScroll(MenuCubeFaceExtensions.GetTitle(this.Face), 0.0f, true); this.wasLowPass = this.SoundManager.IsLowPass; if (!this.wasLowPass) this.SoundManager.FadeFrequencies(true); this.InRtHandle = this.TargetRenderingManager.TakeTarget(); this.OutRtHandle = this.TargetRenderingManager.TakeTarget(); this.TargetRenderingManager.ScheduleHook(this.DrawOrder, this.InRtHandle.Target); }
private void ChangeState() { if (this.ActiveState == DotsAplenty.State.Zooming) { this.Host.eNoise = this.eNoise; this.Host.Cycle(); } else { this.StepTime = 0.0f; ++this.ActiveState; this.Update(new GameTime()); } }
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(); })); }
private void TryInitialize() { this.RainPS = (PlaneParticleSystem) null; this.ePreThunder = (SoundEmitter) null; if (this.lightning != null) this.lightning.Dispose(); this.lightning = (Mesh) null; this.trileTops = (TrileInstance[]) null; this.Visible = this.Enabled = this.LevelManager.Rainy; if (!this.Enabled) return; this.doThunder = this.LevelManager.Name != "INDUSTRIAL_CITY"; if (this.Transition == null) { Vector3 vector3 = this.RainColor.ToVector3(); PlaneParticleSystemSettings settings = new PlaneParticleSystemSettings(); settings.Velocity = (VaryingVector3) new Vector3(0.0f, -50f, 0.0f); settings.SpawningSpeed = 60f; settings.ParticleLifetime = 0.6f; settings.SpawnBatchSize = 10; PlaneParticleSystemSettings particleSystemSettings1 = settings; VaryingVector3 varyingVector3_1 = new VaryingVector3(); varyingVector3_1.Function = RainHost.RainScaling; VaryingVector3 varyingVector3_2 = varyingVector3_1; particleSystemSettings1.SizeBirth = varyingVector3_2; settings.FadeOutDuration = 0.1f; PlaneParticleSystemSettings particleSystemSettings2 = settings; VaryingColor varyingColor1 = new VaryingColor(); varyingColor1.Base = this.RainColor; varyingColor1.Variation = new Color(0, 0, 0, 24); VaryingColor varyingColor2 = varyingColor1; particleSystemSettings2.ColorLife = varyingColor2; settings.ColorDeath = (VaryingColor) new Color(vector3.X, vector3.Y, vector3.Z, 0.0f); settings.ColorBirth = (VaryingColor) new Color(vector3.X, vector3.Y, vector3.Z, 0.0f); settings.Texture = this.CMProvider.Global.Load<Texture2D>("Other Textures/rain/rain"); settings.BlendingMode = BlendingMode.Alphablending; settings.Billboarding = true; settings.NoLightDraw = true; this.PlaneSystems.Add(this.RainPS = new PlaneParticleSystem(this.Game, 500, settings)); for (int index = 0; index < 75; ++index) this.PlaneSystems.RainSplash(Vector3.Zero).FadeOutAndDie(0.0f); } ContentManager contentManager = this.LevelManager.Name == null ? this.CMProvider.Global : this.CMProvider.CurrentLevel; this.lightning = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/rain/lightning_a")) }; this.lightning.AddFace(Vector3.One * new Vector3(16f, 32f, 16f), Vector3.Zero, FaceOrientation.Front, true, true); if (this.lightningSounds == null) this.lightningSounds = new SoundEffect[4] { contentManager.Load<SoundEffect>("Sounds/Graveyard/Thunder1"), contentManager.Load<SoundEffect>("Sounds/Graveyard/Thunder2"), contentManager.Load<SoundEffect>("Sounds/Graveyard/Thunder3"), contentManager.Load<SoundEffect>("Sounds/Graveyard/Thunder4") }; if (this.thunderDistant == null) this.thunderDistant = new SoundEffect[3] { contentManager.Load<SoundEffect>("Sounds/Graveyard/ThunderDistant01"), contentManager.Load<SoundEffect>("Sounds/Graveyard/ThunderDistant02"), contentManager.Load<SoundEffect>("Sounds/Graveyard/ThunderDistant03") }; if (this.sPreThunder == null) this.sPreThunder = contentManager.Load<SoundEffect>("Sounds/Graveyard/ThunderRumble"); this.trileTops = Enumerable.ToArray<TrileInstance>(Enumerable.Where<TrileInstance>((IEnumerable<TrileInstance>) this.LevelManager.Triles.Values, (Func<TrileInstance, bool>) (x => { if (x.Enabled && !x.Trile.Immaterial && !ActorTypeExtensions.IsClimbable(x.Trile.ActorSettings.Type) && (x.Trile.Geometry == null || !x.Trile.Geometry.Empty || x.Trile.Faces[FaceOrientation.Front] != CollisionType.None)) return this.NoTop(x); else return false; }))); this.flashIn = TimeSpan.FromSeconds((double) RandomHelper.Between(4.0, 6.0)); this.distantIn = TimeSpan.FromSeconds((double) RandomHelper.Between(3.0, 6.0)); }
public MovingGroupState(TrileGroup group, bool connective) { this.LevelManager = ServiceHelper.Get<ILevelManager>(); this.CMProvider = ServiceHelper.Get<IContentManagerProvider>(); this.Group = group; this.IsConnective = connective; this.neededTrigger = this.Path.NeedsTrigger; this.paused = this.neededTrigger; this.referenceOrigins = new Vector3[group.Triles.Count]; this.MarkedPosition = Vector3.Zero; int num = 0; foreach (TrileInstance trileInstance in group.Triles) { this.MarkedPosition += trileInstance.Center; this.referenceOrigins[num++] = trileInstance.Position; } this.MarkedPosition /= (float) group.Triles.Count; if (!group.PhysicsInitialized) { foreach (TrileInstance instance in group.Triles) instance.PhysicsState = new InstancePhysicsState(instance); group.PhysicsInitialized = true; } this.Segments = new List<PathSegment>((IEnumerable<PathSegment>) this.Path.Segments); foreach (TrileInstance trileInstance in group.Triles) trileInstance.ForceSeeThrough = true; if (this.Path.EndBehavior == PathEndBehavior.Bounce) { for (int index = this.Segments.Count - 1; index >= 0; --index) { PathSegment pathSegment = this.Segments[index]; Vector3 vector3 = index == 0 ? Vector3.Zero : this.Segments[index - 1].Destination; this.Segments.Add(new PathSegment() { Acceleration = pathSegment.Deceleration, Deceleration = pathSegment.Acceleration, Destination = vector3, Duration = pathSegment.Duration, JitterFactor = pathSegment.JitterFactor, WaitTimeOnFinish = pathSegment.WaitTimeOnStart, WaitTimeOnStart = pathSegment.WaitTimeOnFinish, Bounced = true }); } } if (this.Path.SoundName != null) { try { this.eAssociatedSound = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/" + this.Path.SoundName), Vector3.Zero, true, true); } catch (Exception ex) { Logger.Log("Moving groups", LogSeverity.Warning, "Could not find sound " + this.Path.SoundName); this.Path.SoundName = (string) null; } } if (this.IsConnective) { this.eConnectiveIdle = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Industrial/ConnectiveIdle"), Vector3.Zero, true, true); this.sConnectiveKlonk = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Industrial/ConnectiveKlonk"); this.sConnectiveStartUp = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Industrial/ConnectiveStartUp"); } if (!this.IsConnective) { this.attachedAOs = Enumerable.ToArray<ArtObjectInstance>(Enumerable.Where<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => { int? local_0 = x.ActorSettings.AttachedGroup; int local_1 = group.Id; if (local_0.GetValueOrDefault() == local_1) return local_0.HasValue; else return false; }))); if (this.attachedAOs.Length > 0) this.aoOrigins = Enumerable.ToArray<Vector3>(Enumerable.Select<ArtObjectInstance, Vector3>((IEnumerable<ArtObjectInstance>) this.attachedAOs, (Func<ArtObjectInstance, Vector3>) (x => x.Position))); this.attachedPlanes = Enumerable.ToArray<BackgroundPlane>(Enumerable.Where<BackgroundPlane>((IEnumerable<BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func<BackgroundPlane, bool>) (x => { int? local_0 = x.AttachedGroup; int local_1 = group.Id; if (local_0.GetValueOrDefault() == local_1) return local_0.HasValue; else return false; }))); if (this.attachedPlanes.Length > 0) this.planeOrigins = Enumerable.ToArray<Vector3>(Enumerable.Select<BackgroundPlane, Vector3>((IEnumerable<BackgroundPlane>) this.attachedPlanes, (Func<BackgroundPlane, Vector3>) (x => x.Position))); } else { foreach (TrileInstance trileInstance in this.Group.Triles) trileInstance.ForceClampToGround = true; } this.Enabled = true; this.Silent = true; this.Reset(); this.StartNewSegment(); this.Silent = false; this.sinceSegmentStarted -= TimeSpan.FromSeconds((double) this.Path.OffsetSeconds); }
private void TryInitialize() { this.TrackedStones.Clear(); this.GrabSound = (SoundEffect) null; this.TurnLeft = (SoundEffect) null; this.TurnRight = (SoundEffect) null; this.sRumble = (SoundEffect) null; this.eRumble = (SoundEmitter) null; foreach (ArtObjectInstance ao in (IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values) { if (ao.ArtObject.ActorType == ActorType.Tombstone) this.TrackedStones.Add(new TombstonesHost.TombstoneState(this, ao)); } this.SkullAo = Enumerable.SingleOrDefault<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObjectName == "GIANT_SKULLAO")); this.Enabled = this.Visible = this.TrackedStones.Count > 0 && this.SkullAo != null; if (!this.Enabled) return; int index = this.SkullAo.ActorSettings.AttachedGroup.Value; this.SkullTopLayer = Enumerable.ToArray<TrileInstance>(Enumerable.Where<TrileInstance>((IEnumerable<TrileInstance>) this.LevelManager.Groups[index].Triles, (Func<TrileInstance, bool>) (x => x.Trile.Faces[FaceOrientation.Back] == CollisionType.TopOnly))); this.SkullAttachedTriles = Enumerable.ToArray<TrileInstance>(Enumerable.Where<TrileInstance>((IEnumerable<TrileInstance>) this.LevelManager.Groups[index].Triles, (Func<TrileInstance, bool>) (x => x.Trile.Immaterial))); this.SkullAttachedTrilesOriginalStates = Enumerable.ToArray<Vector4>(Enumerable.Select<TrileInstance, Vector4>((IEnumerable<TrileInstance>) this.SkullAttachedTriles, (Func<TrileInstance, Vector4>) (x => new Vector4(x.Position, x.Phi)))); this.GrabSound = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/MiscActors/GrabLever"); this.TurnLeft = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Graveyard/TombRotateLeft"); this.TurnRight = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Graveyard/TombRotateRight"); this.sRumble = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/MiscActors/Rumble"); this.eRumble = SoundEffectExtensions.Emit(this.sRumble, true, true); this.SkullRotates = Enumerable.Count<TombstonesHost.TombstoneState>((IEnumerable<TombstonesHost.TombstoneState>) this.TrackedStones, (Func<TombstonesHost.TombstoneState, bool>) (x => x.LastViewpoint == this.TrackedStones[0].LastViewpoint)) < 4; this.OriginalRotation = this.SkullAo.Rotation * Quaternion.CreateFromAxisAngle(Vector3.UnitY, 1.570796f); }
private void InitSuckBlocks() { this.HostingVolumes.Clear(); this.TrackedSuckBlocks.Clear(); this.highlightPlanes = (List<BackgroundPlane>) null; this.eCratePush = this.eSuck = (SoundEmitter) null; foreach (TrileGroup group in (IEnumerable<TrileGroup>) this.LevelManager.Groups.Values) { if (group.ActorType == ActorType.SuckBlock) { TrileInstance instance = Enumerable.First<TrileInstance>((IEnumerable<TrileInstance>) group.Triles); if (instance.ActorSettings.HostVolume.HasValue) { this.TrackedSuckBlocks.Add(new SuckBlocksHost.SuckBlockState(instance, group)); SuckBlocksHost.EnableTrile(instance); this.HostingVolumes.Add(this.LevelManager.Volumes[instance.ActorSettings.HostVolume.Value]); } } } if (this.TrackedSuckBlocks.Count <= 0) return; this.eCratePush = SoundEffectExtensions.EmitAt(this.CMProvider.Global.Load<SoundEffect>("Sounds/Gomez/PushPickup"), Vector3.Zero, true, true); this.highlightPlanes = new List<BackgroundPlane>(); }
protected override void End() { if (this.eLast != null && !this.eLast.Dead) { this.eLast.Cue.Stop(false); this.eLast = (SoundEmitter) null; } base.End(); }
protected override bool Act(TimeSpan elapsed) { int num = this.PlayerManager.Animation.Timing.Frame; switch (this.PlayerManager.Action) { case ActionType.IdlePlay: if (this.lastFrame != num) { if (num == 2) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sHatGrab, this.PlayerManager.Position); if (num == 6 || num == 13 || num == 20) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sHatThrow, this.PlayerManager.Position); if (num == 10 || num == 17 || num == 24) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sHatCatch, this.PlayerManager.Position); if (num == 27) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sHatFinalThrow, this.PlayerManager.Position); if (num == 31) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sHatFallOnHead, this.PlayerManager.Position); } if (this.CheckNextIdle()) { num = -1; break; } else break; case ActionType.IdleSleep: if (this.lastFrame != num) { if (num == 1) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sYawn, this.PlayerManager.Position); if (num == 3) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sLayDown, this.PlayerManager.Position); if (num == 11 || num == 21 || (num == 31 || num == 41)) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sSnore, this.PlayerManager.Position); if (num == 50) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sWakeUp, this.PlayerManager.Position); if (num == 51) SoundEffectExtensions.EmitAt(this.sBlink, this.PlayerManager.Position); } if (this.CheckNextIdle()) { num = -1; break; } else break; case ActionType.IdleLookAround: if (this.lastFrame != num) { if (num == 1) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sIdleTurnLeft, this.PlayerManager.Position); if (num == 7) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sIdleTurnRight, this.PlayerManager.Position); if (num == 13) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sIdleTurnUp, this.PlayerManager.Position); if (num == 19) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sIdleFaceFront, this.PlayerManager.Position); } if (this.CheckNextIdle()) { num = -1; break; } else break; case ActionType.IdleYawn: if (this.lastFrame != num && num == 0) this.lastSpecialIdleSound = SoundEffectExtensions.EmitAt(this.sYawn, this.PlayerManager.Position); if (this.CheckNextIdle()) { num = -1; break; } else break; default: if (this.PlayerManager.CanControl) this.changeAnimationIn -= elapsed; if (!this.GameState.TimePaused && !this.PlayerManager.Hidden && (!this.GameState.FarawaySettings.InTransition && !this.PlayerManager.InDoorTransition) && (this.lastFrame != num && (num == 1 || num == 13))) SoundEffectExtensions.EmitAt(this.sBlink, this.PlayerManager.Position); if (this.changeAnimationIn.Ticks <= 0L) { switch (this.lastSpecialIdle) { case ActionType.None: case ActionType.IdlePlay: this.PlayerManager.Action = ActionType.IdleYawn; break; case ActionType.IdleSleep: this.PlayerManager.Action = ActionType.IdleLookAround; break; case ActionType.IdleLookAround: if (this.PlayerManager.HideFez) { this.PlayerManager.Action = ActionType.IdleYawn; break; } else { this.PlayerManager.Action = ActionType.IdlePlay; break; } case ActionType.IdleYawn: this.PlayerManager.Action = ActionType.IdleSleep; break; } this.lastSpecialIdle = this.PlayerManager.Action; num = -1; break; } else break; } this.lastFrame = num; return true; }
public LongRunningAction Say(string line, bool nearGomez, bool hideAfter) { if (this.sTextNext == null) this.sTextNext = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/TextNext"); if (this.sDotTalk == null) this.sDotTalk = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Talk"); bool first = false; bool wasPreventing = false; IWaiter w = (IWaiter) null; return new LongRunningAction((Func<float, float, bool>) ((_, __) => { switch (this.PlayerManager.Action) { case ActionType.Sliding: case ActionType.Teetering: case ActionType.Idle: case ActionType.Walking: case ActionType.Running: if (!first) { this.Dot.ComeOut(); wasPreventing = this.Dot.PreventPoI; this.Dot.PreventPoI = true; if (nearGomez || this.Dot.Hidden || (this.Dot.Burrowing || this.Dot.Behaviour == DotHost.BehaviourType.RoamInVolume)) this.Dot.Behaviour = DotHost.BehaviourType.ReadyToTalk; string local_0 = GameText.GetString(line); this.SpeechBubble.ChangeText(local_0); this.PlayerManager.CanControl = false; this.SpeechBubble.Origin = this.Dot.Position; first = true; if (this.eDotTalk == null || this.eDotTalk.Dead) { this.eDotTalk = SoundEffectExtensions.EmitAt(this.sDotTalk, this.Dot.Position, true); } else { this.eDotTalk.Cue.Resume(); this.eDotTalk.VolumeFactor = 1f; this.eDotTalk.Position = this.Dot.Position; } w = Waiters.Wait(0.0750000029802322 * (double) Util.StripPunctuation(local_0).Length * (Culture.IsCJK ? 2.0 : 1.0), (Action) (() => { if (this.eDotTalk == null) return; this.eDotTalk.FadeOutAndPause(0.1f); })); w.AutoPause = true; } this.SpeechBubble.Origin = this.Dot.Position; if (this.eDotTalk != null && !this.eDotTalk.Dead) this.eDotTalk.Position = this.Dot.Position; if (this.InputManager.CancelTalk != FezButtonState.Pressed) return false; if (w.Alive) w.Cancel(); if (this.eDotTalk != null && !this.eDotTalk.Dead && this.eDotTalk.Cue.State == SoundState.Playing) this.eDotTalk.Cue.Pause(); SoundEffectExtensions.Emit(this.sTextNext); this.SpeechBubble.Hide(); return true; default: return false; } }), (Action) (() => { if (hideAfter) { this.Dot.Burrow(); if (this.LevelManager.Name == "VILLAGEVILLE_3D") this.CameraManager.Constrained = false; } this.Dot.PreventPoI = wasPreventing; this.PlayerManager.CanControl = true; })); }
protected override void End() { base.End(); if (this.lastSpecialIdleSound == null || this.lastSpecialIdleSound.Dead) return; this.lastSpecialIdleSound.FadeOutAndDie(0.1f); this.lastSpecialIdleSound = (SoundEmitter) null; }
public void StopSound() { if (this.eAssociatedSound != null && !this.eAssociatedSound.Dead) { this.eAssociatedSound.FadeOutAndDie(0.25f); this.eAssociatedSound = (SoundEmitter) null; } if (this.eConnectiveIdle == null || this.eConnectiveIdle.Dead) return; this.eConnectiveIdle.FadeOutAndDie(0.1f); this.eConnectiveIdle = (SoundEmitter) null; }
private void TryInitialize() { this.Visible = this.Enabled = this.LevelManager.Name == "PYRAMID"; this.Clear(); if (!this.Enabled) return; this.MotherCubeAo = this.LevelManager.ArtObjects[217]; this.OriginalPosition = this.MotherCubeAo.Position; this.RaysMesh = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/smooth_ray")), Blending = new BlendingMode?(BlendingMode.Additive), SamplerState = SamplerState.AnisotropicClamp, DepthWrites = false, AlwaysOnTop = true }; this.FlareMesh = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/flare_alpha")), Blending = new BlendingMode?(BlendingMode.Alphablending), SamplerState = SamplerState.AnisotropicClamp, DepthWrites = false, AlwaysOnTop = true }; this.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true); this.sRotationDrone = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/Pyramid/MothercubeRotateDrone"); this.sWhiteOut = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ending/Pyramid/WhiteOut"); this.eRotationDrone = SoundEffectExtensions.EmitAt(this.sRotationDrone, this.OriginalPosition, true); }