private void DoPause(object s, EventArgs ea) { bool checkActive = s == this.Game; if (this.loadWaiter != null) { return; } this.loadWaiter = Waiters.Wait((Func <bool>)(() => { if (this.GameState.Loading) { return(false); } if (checkActive) { return(Intro.Instance == null); } else { return(true); } }), (Action)(() => { this.loadWaiter = (IWaiter)null; if (checkActive && this.Game.IsActive || MainMenu.Instance != null) { return; } this.GameState.Pause(); })); }
private void TryAssembleCube() { if (this.AssembleScheduled || this.GameState.SaveData.CollectedParts != 8) { return; } this.AssembleScheduled = true; Waiters.Wait((Func <bool>)(() => { if (!this.GameState.Loading && ActionTypeExtensions.AllowsLookingDirectionChange(this.PlayerManager.Action) && (this.SpeechBubble.Hidden && !this.GameState.ForceTimePaused) && (this.PlayerManager.CanControl && !ActionTypeExtensions.DisallowsRespawn(this.PlayerManager.Action) && (this.CameraManager.ViewTransitionReached && !this.PlayerManager.InDoorTransition))) { return(this.PlayerManager.CarriedInstance == null); } else { return(false); } }), (Action)(() => Waiters.Wait(0.0, (Action)(() => { Vector3 local_0 = FezMath.DepthMask(this.CameraManager.Viewpoint); Vector3 local_1 = FezMath.ForwardVector(this.CameraManager.Viewpoint); TrileInstance local_3 = new TrileInstance((this.PlayerManager.Position + Vector3.UnitY * (float)(Math.Sin(this.timeAcc.TotalSeconds * 3.14159274101257) * 0.100000001490116 + 2.0) - FezMath.HalfVector) * (Vector3.One - local_0) - local_1 * (this.LevelManager.Size / 2f - local_0 * 2f) + local_0 * this.LevelManager.Size / 2f, Enumerable.Last <Trile>((IEnumerable <Trile>) this.LevelManager.TrileSet.Triles.Values, (Func <Trile, bool>)(x => x.ActorSettings.Type == ActorType.CubeShard)).Id); this.LevelManager.RestoreTrile(local_3); this.LevelMaterializer.CullInstanceIn(local_3); this.PlayerManager.ForcedTreasure = local_3; this.PlayerManager.Action = ActionType.FindingTreasure; this.AssembleScheduled = false; })))); }
public void ResolvePuzzle() { ++this.GameState.SaveData.ThisLevel.FilledConditions.SecretCount; List <Volume> currentVolumes = this.PlayerManager.CurrentVolumes; Func <Volume, bool> predicate = (Func <Volume, bool>)(x => { if (x.ActorSettings != null) { return(x.ActorSettings.IsPointOfInterest); } else { return(false); } }); Volume volume; if ((volume = Enumerable.FirstOrDefault <Volume>((IEnumerable <Volume>)currentVolumes, predicate)) != null && volume.Enabled) { volume.Enabled = false; this.GameState.SaveData.ThisLevel.InactiveVolumes.Add(volume.Id); } this.GameState.Save(); SoundEffectExtensions.Emit(this.sSolvedSecret); this.SoundManager.MusicVolumeFactor = 0.125f; Waiters.Wait(2.75, (Action)(() => this.SoundManager.FadeVolume(0.125f, 1f, 3f))).AutoPause = true; }
private void ScheduleHit() { this.wutex2 = (IWaiter)null; this.wutex1 = Waiters.Wait(0.25, (Action)(() => { Waiters.Wait(0.25, (Action)(() => this.wutex1 = (IWaiter)null)); this.PlayerManager.Action = ActionType.HitBell; this.PlayerManager.Animation.Timing.Restart(); this.SinceHit = TimeSpan.Zero; SoundEffectExtensions.EmitAt(this.sBellHit[(int)(this.CameraManager.Viewpoint - 1)], this.BellAo.Position); this.SoundManager.FadeVolume(0.25f, 1f, 2f); this.AngularVelocity += new Vector2(-FezMath.Dot(FezMath.ForwardVector(this.CameraManager.Viewpoint), Vector3.UnitZ), FezMath.Dot(FezMath.ForwardVector(this.CameraManager.Viewpoint), Vector3.UnitX)) * 0.075f; if (this.Solved) { return; } if (this.LastHit != Viewpoint.None && this.LastHit != this.CameraManager.Viewpoint) { this.Hits[this.CameraManager.Viewpoint] = 0; } this.LastHit = this.CameraManager.Viewpoint; Dictionary <Viewpoint, int> local_1; Viewpoint local_2; (local_1 = this.Hits)[local_2 = this.CameraManager.Viewpoint] = local_1[local_2] + 1; if (!Enumerable.All <KeyValuePair <Viewpoint, int> >((IEnumerable <KeyValuePair <Viewpoint, int> >) this.Hits, (Func <KeyValuePair <Viewpoint, int>, bool>)(kvp => kvp.Value == this.ExpectedHits[kvp.Key]))) { return; } this.Solved = true; this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(this.BellAo.Id); this.LevelService.ResolvePuzzle(); ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, this.BellAo, this.OriginalPosition)); })); this.wutex1.AutoPause = true; }
protected override void Begin() { base.Begin(); this.PlayerManager.Velocity = Vector3.Zero; this.camOrigin = this.CameraManager.Center; SoundEffectExtensions.EmitAt(this.sLowerToLedge, this.PlayerManager.Position); Waiters.Wait(0.579999983310699, (Action)(() => SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position))); }
protected override void Begin() { SoundEffectExtensions.EmitAt(this.pullSound, this.PlayerManager.Position); this.camOrigin = this.CameraManager.Center; this.PlayerManager.Velocity = Vector3.Zero; Waiters.Wait(0.5, (Action)(() => SoundEffectExtensions.EmitAt(this.landSound, this.PlayerManager.Position))); this.GomezService.OnHoist(); }
protected override void TestConditions() { switch (this.PlayerManager.Action) { case ActionType.Idle: case ActionType.LookingLeft: case ActionType.LookingRight: case ActionType.LookingUp: case ActionType.LookingDown: case ActionType.Walking: case ActionType.Running: case ActionType.Sliding: case ActionType.Landing: if (this.PlayerManager.Background || (this.InputManager.Jump != FezButtonState.Pressed || !FezButtonStateExtensions.IsDown(this.InputManager.Down)) && (!ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || this.InputManager.Down != FezButtonState.Pressed) || !this.PlayerManager.Grounded || (this.PlayerManager.Ground.First.GetRotatedFace(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) != CollisionType.TopOnly || !FezMath.AlmostEqual(this.InputManager.Movement.X, 0.0f))) { break; } TrileInstance trileInstance1 = this.PlayerManager.Ground.NearLow ?? this.PlayerManager.Ground.FarHigh; if (BoxCollisionResultExtensions.AnyHit(this.CollisionManager.CollideEdge(trileInstance1.Center + trileInstance1.TransformedSize * Vector3.UnitY * 0.498f, Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor), this.PlayerManager.Size * FezMath.XZMask / 2f, Direction2D.Vertical))) { this.PlayerManager.Position -= Vector3.UnitY * 0.01f * (float)Math.Sign(this.CollisionManager.GravityFactor); IPlayerManager playerManager = this.PlayerManager; Vector3 vector3 = playerManager.Velocity - 0.0075f * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor); playerManager.Velocity = vector3; break; } else { if (this.PlayerManager.Grounded) { TrileInstance trileInstance2 = this.LevelManager.NearestTrile(this.PlayerManager.Ground.First.Center, QueryOptions.None).Surface; if (trileInstance2 != null && trileInstance2.Trile.ActorSettings.Type == ActorType.Ladder) { break; } } this.PlayerManager.HeldInstance = this.PlayerManager.Ground.NearLow; Vector3 vector3_1 = FezMath.SideMask(this.CameraManager.Viewpoint); IPlayerManager playerManager = this.PlayerManager; Vector3 vector3_2 = playerManager.Velocity * vector3_1 * 0.5f; playerManager.Velocity = vector3_2; this.PlayerManager.Action = ActionType.LowerToLedge; Waiters.Wait(0.3, (Action)(() => { if (this.PlayerManager.Action != ActionType.LowerToLedge) { return; } SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position); this.PlayerManager.Velocity = Vector3.Zero; })); this.camOrigin = this.CameraManager.Center; break; } } }
private void GlitchReboot() { ServiceHelper.AddComponent((IGameComponent) new Reboot(this.Game, "GOMEZ_HOUSE_END_32")); Waiters.Wait(0.100000001490116, (Action)(() => { this.Destroy(); this.Enabled = this.Visible = false; })); this.Enabled = false; }
public CrumblerState(TrileInstance instance, CrumblersHost host) { ServiceHelper.InjectServices((object)this); this.Host = host; this.Instance = instance; this.OriginalCenter = instance.PhysicsState.Center; Waiters.Wait(0.5, new Action(this.StartCrumbling)).AutoPause = true; Waiters.Wait(2.5, new Action(this.Respawn)).AutoPause = true; SoundEffectExtensions.EmitAt(host.sWarning, this.OriginalCenter, RandomHelper.Centered(0.00999999977648258)); }
private void StartCrumbling() { SoundEffectExtensions.EmitAt(this.Host.sCrumble, this.OriginalCenter, RandomHelper.Centered(0.00999999977648258)); Vector3 vector3_1 = FezMath.SideMask(this.CameraManager.Viewpoint); Vector3 vector3_2 = FezMath.ForwardVector(this.CameraManager.Viewpoint); bool flag1 = (double)vector3_1.X != 0.0; bool flag2 = flag1; int num = flag2 ? (int)vector3_2.Z : (int)vector3_2.X; Point key = new Point(flag1 ? this.Instance.Emplacement.X : this.Instance.Emplacement.Z, this.Instance.Emplacement.Y); this.LevelManager.WaitForScreenInvalidation(); Limit limit; if (this.LevelManager.ScreenSpaceLimits.TryGetValue(key, out limit)) { limit.End += num; TrileEmplacement id = new TrileEmplacement(flag1 ? key.X : limit.Start, key.Y, flag2 ? limit.Start : key.X); while ((flag2 ? id.Z : id.X) != limit.End) { TrileInstance toRemove = this.LevelManager.TrileInstanceAt(ref id); if (toRemove != null && !toRemove.Hidden && toRemove.Trile.ActorSettings.Type == ActorType.Crumbler) { toRemove.Hidden = true; this.LevelMaterializer.CullInstanceOut(toRemove); this.InstancesToClear.Add(toRemove); ITrixelParticleSystems particleSystems = this.ParticleSystems; CrumblersHost.CrumblerState crumblerState = this; Game game = ServiceHelper.Game; TrixelParticleSystem.Settings settings = new TrixelParticleSystem.Settings() { BaseVelocity = Vector3.Zero, Energy = 0.1f, ParticleCount = (int)(20.0 / (double)this.InstancesToClear.Count), GravityModifier = 0.6f, Crumble = true, ExplodingInstance = toRemove }; TrixelParticleSystem trixelParticleSystem1; TrixelParticleSystem trixelParticleSystem2 = trixelParticleSystem1 = new TrixelParticleSystem(game, settings); crumblerState.System = trixelParticleSystem1; TrixelParticleSystem system = trixelParticleSystem2; particleSystems.Add(system); } if (flag2) { id.Z += num; } else { id.X += num; } } } Waiters.Wait(1.0, new Action(this.ClearTriles)).AutoPause = true; }
protected override void Begin() { base.Begin(); SoundEffectExtensions.EmitAt(this.pullSound, this.PlayerManager.Position); Vector3 vector3 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection); this.camOrigin = this.CameraManager.Center; this.gomezDelta = this.PlayerManager.Size * (vector3 + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) / 2f; Waiters.Wait(0.579999983310699, (Action)(() => SoundEffectExtensions.EmitAt(this.landSound, this.PlayerManager.Position))); this.GomezService.OnHoist(); }
public void UnmuteAmbience(string trackName, float fadeDuration) { if (this.ActiveAmbience != null) { this.ActiveAmbience.UnmuteTrack(trackName, fadeDuration); } else { Waiters.Wait((Func <bool>)(() => this.ActiveAmbience != null), (Action)(() => this.ActiveAmbience.UnmuteTrack(trackName, fadeDuration))); } }
public override void Update(GameTime gameTime) { if (this.GameState.Paused || this.GameState.InMap || (!this.CameraManager.ActionRunning || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)) || this.GameState.Loading) { return; } if (this.DoCapture) { this.TimeAccumulator += (float)(gameTime.ElapsedGameTime.TotalSeconds * 1.5); this.MotherCubeAo.Position = Vector3.Lerp(this.MotherCubeAo.Position, this.OriginalPosition, 0.025f); this.MotherCubeAo.Rotation = Quaternion.Slerp(this.MotherCubeAo.Rotation, Quaternion.CreateFromYawPitchRoll(FezMath.ToPhi(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)), 0.0f, 0.0f), 0.025f); this.PlayerManager.Position = Vector3.Lerp(this.PlayerManager.Position, this.PlayerManager.Position * FezMath.DepthMask(this.CameraManager.Viewpoint) + PyramidHost.DoorCenter.X * FezMath.SideMask(this.CameraManager.Viewpoint) + PyramidHost.DoorCenter.Y * Vector3.UnitY - Vector3.UnitY * 0.125f, 0.025f); this.GameState.SkipRendering = true; this.CameraManager.Center = Vector3.Lerp(this.OriginalCenter, this.PlayerManager.Position, 0.025f); this.GameState.SkipRendering = false; this.UpdateRays((float)gameTime.ElapsedGameTime.TotalSeconds); if ((double)this.TimeAccumulator <= 6.0) { return; } this.GameState.SkipLoadScreen = true; this.LevelManager.ChangeLevel("HEX_REBUILD"); Waiters.Wait((Func <bool>)(() => !this.GameState.Loading), (Action)(() => { this.GameState.SkipLoadScreen = false; this.Clear(); this.Visible = false; })); this.Enabled = false; } else { this.TimeAccumulator += (float)(gameTime.ElapsedGameTime.TotalSeconds / 2.0); this.TimeAccumulator = FezMath.WrapAngle(this.TimeAccumulator); this.MotherCubeAo.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.UnitY, (float)(-gameTime.ElapsedGameTime.TotalSeconds * 0.375)); Vector3 vector3 = new Vector3(0.0f, (float)Math.Sin((double)this.TimeAccumulator), 0.0f) / 2f; this.MotherCubeAo.Position = this.OriginalPosition + vector3; Vector2 vector2 = new Vector2(FezMath.Dot(this.PlayerManager.Center, FezMath.SideMask(this.CameraManager.Viewpoint)), this.PlayerManager.Center.Y); if ((double)Math.Abs(vector2.X - PyramidHost.DoorCenter.X) >= 1.0 || (double)Math.Abs(vector2.Y - (PyramidHost.DoorCenter.Y + vector3.Y)) >= 1.0 || (double)FezMath.AngleBetween(Vector3.Transform(-Vector3.UnitZ, this.MotherCubeAo.Rotation), FezMath.ForwardVector(this.CameraManager.Viewpoint)) >= 0.25) { return; } this.DoCapture = true; this.TimeAccumulator = 0.0f; this.PlayerManager.CanControl = false; this.PlayerManager.Action = ActionType.Floating; this.PlayerManager.Velocity = Vector3.Zero; this.OriginalCenter = this.CameraManager.Center; this.eRotationDrone.FadeOutAndDie(1.5f); this.SoundManager.PlayNewSong(5f); SoundEffectExtensions.Emit(this.sWhiteOut).Persistent = true; } }
protected override void TestConditions() { switch (this.PlayerManager.Action) { case ActionType.Jumping: case ActionType.Falling: HorizontalDirection lookingDirection = this.PlayerManager.LookingDirection; if (lookingDirection == HorizontalDirection.None) { break; } Vector3 vector3_1 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); Vector3 b = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(lookingDirection); if ((double)FezMath.Dot(this.PlayerManager.Velocity, b) <= 0.025000000372529 && (double)(this.InputManager.Movement.X * (float)FezMath.Sign(lookingDirection)) <= 0.100000001490116) { break; } MultipleHits <CollisionResult> wallCollision = this.PlayerManager.WallCollision; FaceOrientation visibleOrientation = this.CameraManager.VisibleOrientation; TrileInstance trileInstance1 = wallCollision.NearLow.Destination ?? this.PlayerManager.CornerCollision[1 + (lookingDirection == HorizontalDirection.Left ? 2 : 0)].Instances.Deep; TrileInstance trileInstance2 = wallCollision.FarHigh.Destination ?? this.PlayerManager.CornerCollision[lookingDirection == HorizontalDirection.Left ? 2 : 0].Instances.Deep; Trile trile = trileInstance1 == null ? (Trile)null : trileInstance1.Trile; if (trileInstance1 == null || trileInstance1.GetRotatedFace(visibleOrientation) == CollisionType.None || (trile.ActorSettings.Type == ActorType.Ladder || trileInstance1 == trileInstance2) || (trileInstance2 != null && trileInstance2.GetRotatedFace(visibleOrientation) == CollisionType.AllSides || !trileInstance1.Enabled)) { break; } TrileInstance trileInstance3 = this.LevelManager.ActualInstanceAt(trileInstance1.Center - b); TrileInstance trileInstance4 = this.LevelManager.NearestTrile(trileInstance1.Center - b).Deep; if (trileInstance4 != null && trileInstance4.Enabled && trileInstance4.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.None || trileInstance3 != null && trileInstance3.Enabled && !trileInstance3.Trile.Immaterial || this.PlayerManager.Action == ActionType.Jumping && (double)((trileInstance1.Center - this.PlayerManager.LeaveGroundPosition) * vector3_1).Length() < 1.25 || trileInstance1.GetRotatedFace(visibleOrientation) != CollisionType.AllSides && BoxCollisionResultExtensions.AnyHit(this.CollisionManager.CollideEdge(trileInstance1.Center, Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor), this.PlayerManager.Size * FezMath.XZMask / 2f, Direction2D.Vertical))) { break; } Vector3 vector3_2 = (-b + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) * trileInstance1.TransformedSize / 2f; if ((double)(this.PlayerManager.Center * vector3_1 - trileInstance1.Center * vector3_1 + vector3_2).Length() >= 0.349999994039536) { break; } this.PlayerManager.HeldInstance = trileInstance1; this.PlayerManager.Action = ActionType.GrabCornerLedge; Waiters.Wait(0.1, (Action)(() => { if (this.PlayerManager.HeldInstance == null) { return; } SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position); this.InputManager.ActiveGamepad.Vibrate(VibrationMotor.LeftLow, 0.100000001490116, TimeSpan.FromSeconds(0.200000002980232)); this.InputManager.ActiveGamepad.Vibrate(VibrationMotor.RightHigh, 0.400000005960464, TimeSpan.FromSeconds(0.200000002980232)); })); break; } }
public void GrabOnto() { this.PlayerManager.Action = ActionType.GrabTombstone; Waiters.Wait(0.4, (Func <float, bool>)(_ => this.PlayerManager.Action != ActionType.GrabTombstone), (Action)(() => { if (this.PlayerManager.Action != ActionType.GrabTombstone) { return; } SoundEffectExtensions.EmitAt(this.Host.GrabSound, this.ArtObject.Position); this.State = SpinAction.Grabbed; })); }
protected override void ReturnToArcade() { if (this.GameState.IsTrialMode) { this.GameService.EndTrial(true); Waiters.Wait(0.100000001490116, (Action)(() => ServiceHelper.RemoveComponent <PauseMenu>(this))); } else { this.GameState.ReturnToArcade(); } this.Enabled = false; }
private void TestCodePattern(Volume volume) { if (PatternTester.Test((IList <CodeInput>) this.Input, volume.ActorSettings.CodePattern)) { this.Input.Clear(); Waiters.Wait((Func <bool>)(() => this.CameraManager.ViewTransitionReached), (Action)(() => { this.VolumeService.OnCodeAccepted(volume.Id); this.GameState.SaveData.AnyCodeDeciphered = true; this.LevelService.ResolvePuzzle(); })); } this.SinceInput = TimeSpan.Zero; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (this.StarMesh != null) { this.StarMesh.Dispose(); } if (this.Flare != null) { this.Flare.Dispose(); } this.Flare = this.StarMesh = (Mesh)null; Waiters.Wait(2.0, (Action)(() => this.CMProvider.Dispose(CM.EndCutscene))); }
private void SmoothReboot() { ServiceHelper.AddComponent((IGameComponent) new Intro(this.Game) { Fake = true, FakeLevel = "GOMEZ_HOUSE", Glitch = false }); Waiters.Wait(0.100000001490116, (Action)(() => { this.Destroy(); this.Enabled = this.Visible = false; })); this.Enabled = false; }
private void Open() { this.GroupService.RunPathOnce(this.AttachedGroup.Id, false); this.PlayerManager.CanControl = false; this.Enabled = false; this.PlayerManager.Action = ActionType.WalkingTo; this.WalkToService.Destination = new Func <Vector3>(this.GetDestination); this.WalkToService.NextAction = ActionType.Idle; this.eRumble = SoundEffectExtensions.EmitAt(this.sRumble, this.DoorAo.Position, true); Waiters.Wait(1.5, (Action)(() => this.eRumble.FadeOutAndDie(0.5f))).AutoPause = true; Waiters.Wait(2.0, (Action)(() => { this.PlayerManager.CanControl = true; this.PlayerManager.Action = ActionType.OpeningDoor; this.PlayerManager.Action = ActionType.Idle; })).AutoPause = true; }
private void TryInitialize() { this.Enabled = this.LevelManager.Name == "OWL"; if (!this.Enabled) return; int num1; try { num1 = int.Parse(this.GameState.SaveData.ThisLevel.ScriptingState); } catch (Exception ex) { num1 = 0; } int num2 = this.GameState.SaveData.CollectedOwls; int num3 = 0; foreach (NpcInstance npcInstance in (IEnumerable<NpcInstance>) this.LevelManager.NonPlayerCharacters.Values) { if (npcInstance.ActorType == ActorType.Owl) { if (num2 <= num3) { ServiceHelper.RemoveComponent<NpcState>(npcInstance.State); } else { (npcInstance.State as GameNpcState).ForceVisible = true; (npcInstance.State as GameNpcState).IsNightForOwl = num3 < num1; } ++num3; } } if (num1 == 4 && this.GameState.SaveData.ThisLevel.FilledConditions.SecretCount == 0) { Waiters.Wait((Func<bool>) (() => { if (!this.GameState.Loading) return !this.GameState.FarawaySettings.InTransition; else return false; }), (Action) (() => this.OwlService.OnOwlLanded())); this.Enabled = false; } this.GameState.SaveData.ThisLevel.ScriptingState = num2.ToString((IFormatProvider) CultureInfo.InvariantCulture); }
private void CheckForPattern() { if (!this.Enabled || this.GameState.Loading) { return; } this.Input.Add(FezMath.GetDistance(this.CameraManager.Viewpoint, this.CameraManager.LastViewpoint) == 1 ? VibrationMotor.LeftLow : VibrationMotor.RightHigh); if (this.Input.Count > 16) { this.Input.RemoveAt(0); } if (!PatternTester.Test((IList <VibrationMotor>) this.Input, this.ArtObject.ActorSettings.VibrationPattern)) { return; } this.Input.Clear(); this.Enabled = false; Waiters.Wait((Func <bool>)(() => this.CameraManager.ViewTransitionReached), new Action(this.Solve)); }
public void Rotate(int id, bool clockwise, int turns) { if (!this.Enabled) { return; } foreach (RotatingGroupsHost.RotatingGroupState rotatingGroupState in this.RotatingGroups) { if (rotatingGroupState.Group.Id == id) { RotatingGroupsHost.RotatingGroupState cached = rotatingGroupState; Waiters.Wait((Func <bool>)(() => cached.Action == SpinAction.Idle), (Action)(() => { cached.Rotate(clockwise, turns); cached.SinceChanged = 0.0f; })); } } }
public override void Update(GameTime gameTime) { if (this.GameState.Paused || this.GameState.InMap) { return; } this.SinceStarted += gameTime.ElapsedGameTime; this.GameState.FarawaySettings.TransitionStep = FezMath.Saturate((float)this.SinceStarted.TotalSeconds / 6f); float amount = this.GameState.FarawaySettings.TransitionStep; this.GameState.FarawaySettings.OriginFadeOutStep = FezMath.Saturate((float)this.SinceStarted.TotalSeconds / 0.75f); this.GameState.FarawaySettings.DestinationCrossfadeStep = FezMath.Saturate((float)((this.SinceStarted.TotalSeconds - 4.5) / 0.75)); if ((double)this.GameState.FarawaySettings.DestinationCrossfadeStep > 0.0 && !this.PlayerManager.CanControl && this.PlayerManager.Action != ActionType.ExitDoor) { this.LevelMaterializer.PrepareFullCull(); this.PlayerManager.Action = ActionType.ExitDoor; } if ((double)this.GameState.FarawaySettings.DestinationCrossfadeStep > 0.5 && !this.PlayerManager.CanControl) { this.PlayerManager.CanControl = true; } if ((double)this.GameState.FarawaySettings.OriginFadeOutStep != 1.0) { this.CameraManager.Radius = MathHelper.Lerp(this.OriginalRadius, this.DestinationRadius / 4f, amount); } if (this.GameState.FarawaySettings.LoadingAllowed) { this.GameState.Loading = true; Worker <bool> worker = this.ThreadPool.Take <bool>(new Action <bool>(this.DoLoad)); worker.Finished += (Action)(() => this.ThreadPool.Return <bool>(worker)); worker.Start(false); this.GameState.FarawaySettings.LoadingAllowed = false; } if ((double)amount != 1.0) { return; } this.CameraManager.PixelsPerTrixel = this.GameState.FarawaySettings.DestinationPixelsPerTrixel; this.DotManager.RevertDrawOrder(); this.Enabled = false; Waiters.Wait(0.25, (Action)(() => ServiceHelper.RemoveComponent <FarawayTransition>(this))); }
public override void Update(GameTime gameTime) { if (this.GameState.Loading) { return; } if (this.MoveUp) { if (this.eRumble == null) { this.eRumble = SoundEffectExtensions.EmitAt(this.sRumble, this.DoorAo.Position, true, 0.0f, 0.625f); Waiters.Wait(1.25, (Action)(() => this.eRumble.FadeOutAndDie(0.25f))).AutoPause = true; } this.DoMoveUp(gameTime.ElapsedGameTime); } else { if (!this.DoorAo.Visible || this.DoorAo.ActorSettings.Inactive || (this.CameraManager.Viewpoint != this.ExpectedViewpoint || this.PlayerManager.Background)) { return; } Vector3 vector3 = FezMath.Abs(this.DoorAo.Position - this.PlayerManager.Position) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); bool b = (double)vector3.X + (double)vector3.Z < 0.75 && (double)vector3.Y < 2.0 && (double)FezMath.Dot(this.DoorAo.Position - this.PlayerManager.Position, FezMath.ForwardVector(this.CameraManager.Viewpoint)) >= 0.0; float opacity = this.GlowPlane.Opacity; this.GlowPlane.Opacity = MathHelper.Lerp(this.GlowPlane.Opacity, (float)FezMath.AsNumeric(b), 0.05f); if ((double)this.GlowPlane.Opacity > (double)opacity && (double)opacity > 0.100000001490116 && this.loop) { SoundEffectExtensions.EmitAt(this.sLightUp, this.DoorAo.Position); this.loop = false; } else if ((double)this.GlowPlane.Opacity < (double)opacity && !this.loop) { SoundEffectExtensions.EmitAt(this.sFadeOut, this.DoorAo.Position); this.loop = true; } if (!b || !this.PlayerManager.Grounded || this.InputManager.ExactUp != FezButtonState.Pressed) { return; } this.Open(); } }
public void ChangeText(string toText) { this.originalString = toText.ToUpper(CultureInfo.InvariantCulture); if (this.changingText) { return; } this.changingText = true; Waiters.Wait((Func <bool>)(() => (double)this.sinceShown == 0.0), (Action)(() => { if (!this.changingText) { return; } this.changingText = false; this.UpdateBTexture(); this.OnTextChanged(false); this.show = true; })).AutoPause = true; }
public void Checkpoint() { Waiters.Wait((Func <bool>)(() => { if (this.PlayerManager.Grounded) { return(ActorTypeExtensions.IsSafe(this.PlayerManager.Ground.First.Trile.ActorSettings.Type)); } else { return(false); } }), (Action)(() => { if (this.LevelManager.Name == "LAVA" && (double)this.LevelManager.WaterHeight < 50.0) { this.LevelManager.WaterHeight = 132f; } this.PlayerManager.RecordRespawnInformation(true); })); }
protected override void TestConditions() { switch (this.PlayerManager.Action) { case ActionType.Jumping: case ActionType.Falling: if (!FezButtonStateExtensions.IsDown(this.InputManager.Up)) { break; } FaceOrientation face = FezMath.VisibleOrientation(this.CameraManager.Viewpoint); TrileInstance trileInstance1 = this.PlayerManager.AxisCollision[VerticalDirection.Up].Deep; TrileInstance trileInstance2 = this.PlayerManager.AxisCollision[VerticalDirection.Down].Deep; if (trileInstance1 != null && trileInstance1.GetRotatedFace(face) == CollisionType.AllSides || (trileInstance2 == null || trileInstance2.GetRotatedFace(face) != CollisionType.TopOnly) || BoxCollisionResultExtensions.AnyHit(this.CollisionManager.CollideEdge(trileInstance2.Center, Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor), this.PlayerManager.Size * FezMath.XZMask / 2f, Direction2D.Vertical))) { break; } TrileInstance trileInstance3 = this.PlayerManager.AxisCollision[VerticalDirection.Down].Surface; if (trileInstance3 != null && ActorTypeExtensions.IsClimbable(trileInstance3.Trile.ActorSettings.Type) || !trileInstance2.Enabled || this.PlayerManager.Action == ActionType.Jumping && (double)((trileInstance2.Center - this.PlayerManager.LeaveGroundPosition) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint)).Length() < 1.25) { break; } this.PlayerManager.Action = ActionType.GrabLedgeBack; Vector3 vector3_1 = FezMath.DepthMask(this.CameraManager.Viewpoint); Vector3 vector3_2 = FezMath.SideMask(this.CameraManager.Viewpoint); Vector3 vector3_3 = FezMath.ForwardVector(this.CameraManager.Viewpoint); this.PlayerManager.HeldInstance = trileInstance2; IPlayerManager playerManager = this.PlayerManager; Vector3 vector3_4 = playerManager.Velocity * vector3_2 * 0.5f; playerManager.Velocity = vector3_4; this.PlayerManager.Position = this.PlayerManager.Position * vector3_2 + trileInstance2.Center * (Vector3.UnitY + vector3_1) + vector3_3 * -(this.PlayerManager.HeldInstance.TransformedSize / 2f + this.PlayerManager.Size.X * vector3_1 / 4f) + this.PlayerManager.HeldInstance.Trile.Size.Y / 2f * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor); Waiters.Wait(0.1, (Action)(() => { SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position); this.PlayerManager.Velocity = Vector3.Zero; })); break; } }
public override void Update(GameTime gameTime) { if (this.GameState.Loading || this.GameState.Paused || this.SinceCreated.TotalSeconds <= 7.0) { return; } if (this.GameState.InCutscene && Intro.Instance != null) { ServiceHelper.RemoveComponent <Intro>(Intro.Instance); } Intro intro = new Intro(this.Game) { Fake = true, FakeLevel = this.ToLevel, Glitch = true }; this.TimeManager.TimeFactor = this.TimeManager.DefaultTimeFactor; this.TimeManager.CurrentTime = DateTime.Now; ServiceHelper.AddComponent((IGameComponent)intro); Waiters.Wait(0.100000001490116, (Action)(() => ServiceHelper.RemoveComponent <Reboot>(this))); this.Enabled = false; }
public WaterfallState(BackgroundPlane plane, PlaneParticleSystem ps, WaterfallsHost host) { WaterfallsHost.WaterfallState waterfallState = this; ServiceHelper.InjectServices((object)this); this.Host = host; this.Plane = plane; this.ParticleSystem = ps; bool flag = plane.ActorType == ActorType.Trickle; this.Splash = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, this.LevelManager.WaterType != LiquidType.Sewer ? (this.LevelManager.WaterType != LiquidType.Purple ? this.CMProvider.CurrentLevel.Load <AnimatedTexture>("Background Planes/water/" + (flag ? "water_small_splash" : "water_large_splash")) : this.CMProvider.CurrentLevel.Load <AnimatedTexture>("Background Planes/waterPink/" + (flag ? "water_small_splash" : "water_large_splash"))) : this.CMProvider.CurrentLevel.Load <AnimatedTexture>("Background Planes/sewer/" + (flag ? "sewer_small_splash" : "sewer_large_splash"))) { Doublesided = true, Crosshatch = true }; this.LevelManager.AddPlane(this.Splash); this.Top = FezMath.Dot(this.Plane.Position + this.Plane.Scale * this.Plane.Size / 2f, Vector3.UnitY); this.TerminalPosition = this.Plane.Position - this.Plane.Scale * this.Plane.Size / 2f * Vector3.UnitY + Vector3.Transform(Vector3.UnitZ, plane.Rotation) / 16f; foreach (BackgroundPlane backgroundPlane in Enumerable.Where <BackgroundPlane>((IEnumerable <BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func <BackgroundPlane, bool>)(x => { int?local_0 = x.AttachedPlane; int local_1 = plane.Id; if ((local_0.GetValueOrDefault() != local_1 ? 0 : (local_0.HasValue ? 1 : 0)) != 0) { return(FezMath.AlmostEqual(Vector3.Transform(Vector3.UnitZ, plane.Rotation).Y, 0.0f)); } else { return(false); } }))) { this.AttachedPlanes.Add(backgroundPlane); } Vector3 position = this.LevelManager.WaterType == LiquidType.None ? this.Top * Vector3.UnitY + this.Plane.Position * FezMath.XZMask : this.TerminalPosition * FezMath.XZMask + this.LevelManager.WaterHeight * Vector3.UnitY; Waiters.Wait((double)RandomHelper.Between(0.0, 1.0), (Action)(() => waterfallState.BubblingEmitter = SoundEffectExtensions.EmitAt(waterfallState.Host.SewageFallSound, position, true, RandomHelper.Centered(0.025), 0.0f))); }