private void RotateViewRight() { bool flag = this.PlayerManager.Action == ActionType.GrabTombstone; if (this.CameraManager.Viewpoint == Viewpoint.Perspective || this.GameState.InMap) { this.CameraManager.OriginalDirection = Vector3.Transform(this.CameraManager.OriginalDirection, Quaternion.CreateFromAxisAngle(Vector3.Up, 1.570796f)); if (!this.GameState.InMenuCube && !this.GameState.InMap) { this.EmitRight(); } } else if (this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, 1), (flag ? 2f : 1f) * Math.Abs(1f / this.CollisionManager.GravityFactor)) && !flag) { this.EmitRight(); } if (this.LevelManager.NodeType != LevelNodeType.Lesser || !(this.PlayerManager.AirTime != TimeSpan.Zero)) { return; } IPlayerManager playerManager = this.PlayerManager; Vector3 vector3 = playerManager.Velocity * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); playerManager.Velocity = vector3; }
protected override void Begin() { SoundEffectExtensions.Emit(this.SwooshRight); this.originalForward = FezMath.ForwardVector(this.CameraManager.Viewpoint); this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, 2)); this.PlayerManager.LookingDirection = HorizontalDirection.Right; this.PlayerManager.Velocity = Vector3.Zero; this.originalPosition = this.PlayerManager.Position; this.distanceToCover = FezMath.Dot(this.LevelManager.NearestTrile(this.PlayerManager.Ground.First.Center, QueryOptions.None, new Viewpoint?(this.CameraManager.Viewpoint)).Deep.Center - this.originalPosition, this.originalForward); }
protected override void Begin() { base.Begin(); if (this.GameState.IsTrialMode && this.PlayerManager.DoorEndsTrial) { this.GameService.EndTrial(false); this.PlayerManager.Action = ActionType.ExitDoor; this.PlayerManager.Action = ActionType.Idle; } else if (!this.PlayerManager.DoorVolume.HasValue || !this.LevelManager.Volumes.ContainsKey(this.PlayerManager.DoorVolume.Value)) { this.PlayerManager.Action = ActionType.Idle; } else { if (!this.PlayerManager.SpinThroughDoor) { SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position); } this.hasFlipped = this.hasChangedLevel = false; this.newLevel = this.PlayerManager.NextLevel; this.step = 0.0f; this.PlayerManager.InDoorTransition = true; this.transitionTime = new TimeSpan(); IPlayerManager playerManager = this.PlayerManager; Vector3 vector3_1 = playerManager.Velocity * Vector3.UnitY; playerManager.Velocity = vector3_1; if (this.PlayerManager.SpinThroughDoor) { this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, 1), 2f); this.PlayerManager.LookingDirection = HorizontalDirection.Right; } if (this.LevelManager.DestinationIsFarAway) { Vector3 center = this.CameraManager.Center; float num = (float)(4.0 * (this.LevelManager.Descending ? -1.0 : 1.0)) / this.CameraManager.PixelsPerTrixel; this.CameraManager.StickyCam = false; this.CameraManager.Constrained = true; Volume volume = this.LevelManager.Volumes[this.PlayerManager.DoorVolume.Value]; Vector2 vector2 = volume.ActorSettings == null ? Vector2.Zero : volume.ActorSettings.FarawayPlaneOffset; if (volume.ActorSettings != null && volume.ActorSettings.WaterLocked) { vector2.Y = volume.ActorSettings.WaterOffset / 2f; } if (volume.ActorSettings != null) { this.GameState.FarawaySettings.DestinationOffset = volume.ActorSettings.DestinationOffset; } Vector3 vector3_2 = FezMath.RightVector(this.CameraManager.Viewpoint) * vector2.X + Vector3.Up * vector2.Y; Vector3 destinationCenter = new Vector3(this.PlayerManager.Position.X, this.PlayerManager.Position.Y + num, this.PlayerManager.Position.Z) + vector3_2 * 2f; this.StartTransition(center, destinationCenter); } this.GomezService.OnEnterDoor(); } }
public void AlterTransition(Viewpoint newTo) { Viewpoint rotatedView = FezMath.GetRotatedView(FezMath.AsViewpoint(FezMath.OrientationFromDirection(this.directionTransition.Points[0])), FezMath.GetDistance(FezMath.AsViewpoint(FezMath.OrientationFromDirection(this.directionTransition.Points[2])), newTo)); Vector3 from = this.predefinedViews[rotatedView].Direction; Vector3 to = this.predefinedViews[newTo].Direction; this.directionTransition.Points[0] = from; this.directionTransition.Points[1] = DefaultCameraManager.GetIntemediateVector(from, to); this.directionTransition.Points[2] = to; this.current = this.predefinedViews[newTo]; this.lastViewpoint = rotatedView; this.viewpoint = newTo; }
public void Update(float elapsedSeconds) { if (!this.Enabled && this.Action == SpinAction.Idle) { return; } this.SinceChanged += elapsedSeconds; float spinFrequency = this.Group.SpinFrequency; switch (this.Action) { case SpinAction.Idle: if ((double)this.SinceChanged < (double)spinFrequency) { break; } this.SinceChanged -= spinFrequency; this.Rotate(this.Group.SpinClockwise, this.Group.Spin180Degrees ? 2 : 1); break; case SpinAction.Spinning: float num1 = Easing.EaseInOut((double)FezMath.Saturate(FezMath.Saturate(this.SinceChanged / (0.75f * (float)this.Turns)) / 0.75f), EasingType.Quartic, EasingType.Quadratic); float angle = num1 * 1.570796f * (float)this.SpinSign * (float)this.Turns; Matrix fromAxisAngle1 = Matrix.CreateFromAxisAngle(Vector3.UnitY, angle); Quaternion fromAxisAngle2 = Quaternion.CreateFromAxisAngle(Vector3.UnitY, angle); if (!this.PlayerManager.IsOnRotato && (double)num1 < 0.5) { RotatingGroupsHost.RotatingGroupState rotatingGroupState1 = this; int num2 = rotatingGroupState1.HeldOnto | this.Group.Triles.Contains(this.PlayerManager.HeldInstance) ? 1 : 0; rotatingGroupState1.HeldOnto = num2 != 0; RotatingGroupsHost.RotatingGroupState rotatingGroupState2 = this; int num3 = (rotatingGroupState2.GroundedOn ? 1 : 0) | (!this.PlayerManager.Grounded ? 0 : (this.TopLayer.Contains(this.PlayerManager.Ground.First) ? 1 : 0)); rotatingGroupState2.GroundedOn = num3 != 0; if (this.GroundedOn || this.HeldOnto) { this.OriginalPlayerPosition = this.PlayerManager.Position; this.PlayerManager.IsOnRotato = true; } } if ((this.GroundedOn || this.HeldOnto) && ((double)num1 > 0.100000001490116 && !this.CameraManager.ForceTransition)) { if (this.HeldOnto && this.Group.FallOnRotate) { this.PlayerManager.Action = ActionType.Idle; this.PlayerManager.HeldInstance = (TrileInstance)null; this.PlayerManager.IsOnRotato = false; this.HeldOnto = false; } else { this.CameraManager.ForceTransition = true; this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, this.SpinSign * this.Turns), -1f); this.CameraManager.Direction = -FezMath.ForwardVector(this.CameraManager.LastViewpoint); this.CameraManager.RebuildView(); } } Vector3 vector3_1 = new Vector3(this.Center.X - 0.5f, this.Center.Y - 0.5f, this.Center.Z - 0.5f); for (int index = 0; index < this.OriginalStates.Length; ++index) { TrileInstance instance = this.Group.Triles[index]; Vector4 vector4 = this.OriginalStates[index]; Vector3 vector3_2 = Vector3.Transform(new Vector3(vector4.X, vector4.Y, vector4.Z), fromAxisAngle1); instance.Position = new Vector3(vector3_2.X + vector3_1.X, vector3_2.Y + vector3_1.Y, vector3_2.Z + vector3_1.Z); instance.SetPhiLight(vector4.W + angle); this.CachedMaterializers[index].UpdateInstance(instance); } for (int index = 0; index < this.AttachedArtObjects.Length; ++index) { this.AttachedArtObjects[index].Rotation = this.AttachedAoRotations[index] * fromAxisAngle2; this.AttachedArtObjects[index].Position = Vector3.Transform(this.AttachedAoOrigins[index] - this.Center, fromAxisAngle1) + this.Center; } if (this.GroundedOn || this.HeldOnto) { Vector3 position = this.PlayerManager.Position; Vector3 vector3_2 = Vector3.Transform(this.OriginalPlayerPosition - this.Center, fromAxisAngle1) + this.Center; if (!this.HeldOnto || !this.Group.FallOnRotate) { this.CameraManager.Center += vector3_2 - position; this.CameraManager.Direction = Vector3.Transform(-this.OriginalForward, fromAxisAngle1); } this.PlayerManager.Position += vector3_2 - position; } if ((double)this.SinceChanged < 0.75 * (double)this.Turns) { break; } if (this.GroundedOn || this.HeldOnto) { this.PlayerManager.IsOnRotato = false; this.RotateTriles(); this.CameraManager.ForceTransition = false; this.PlayerManager.ForceOverlapsDetermination(); } else { this.RotateTriles(); } this.SinceChanged -= 0.75f; this.Action = SpinAction.Idle; break; } }
protected override bool Act(TimeSpan elapsed) { if (this.GameState.Loading) { return(false); } if (ActionTypeExtensions.IsEnteringDoor(this.PlayerManager.Action)) { this.PlayerManager.Animation.Timing.Update(elapsed); } if ((double)this.step < 1.0 && !this.hasFlipped && this.PlayerManager.SpinThroughDoor) { Vector3 position = this.PlayerManager.Position; this.PlayerManager.Position = Vector3.Lerp(this.spinOrigin, this.spinDestination, this.step); if (this.PlayerManager.CarriedInstance != null) { this.PlayerManager.CarriedInstance.Position += this.PlayerManager.Position - position; } } if (string.IsNullOrEmpty(this.newLevel)) { this.PlayerManager.Action = ActionType.Idle; this.step = -1f; this.PlayerManager.InDoorTransition = false; return(false); } else { this.transitionTime += elapsed; this.step = (float)(this.transitionTime.TotalSeconds / (this.PlayerManager.SpinThroughDoor ? 0.75 : 1.25)); if ((double)this.step >= 1.0 && !this.hasFlipped) { if (this.LevelManager.DestinationIsFarAway) { ServiceHelper.AddComponent((IGameComponent) new FarawayTransition(this.Game)); this.PlayerManager.Action = ActionType.Idle; this.step = -1f; this.PlayerManager.InDoorTransition = false; return(false); } else { if (this.skipFade) { this.DoLoad(false); } else { 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.transitionTime = new TimeSpan(); this.step = 0.0f; this.hasFlipped = true; } } else if ((double)this.step >= 1.0 && this.hasFlipped) { this.step = -1f; this.PlayerManager.SpinThroughDoor = false; this.PlayerManager.InDoorTransition = false; if (ActionTypeExtensions.IsEnteringDoor(this.PlayerManager.Action)) { this.PlayerManager.Action = ActionType.Idle; } } if (this.PlayerManager.SpinThroughDoor && this.hasFlipped && (this.CameraManager.ActionRunning && !this.hasChangedLevel)) { this.hasChangedLevel = true; this.GameState.SkipRendering = true; this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, -1), 0.0f); this.CameraManager.SnapInterpolation(); this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, 1)); this.GameState.SkipRendering = false; } return(false); } }
public void Rotate(int distance) { this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, distance)); }
protected override void TestConditions() { switch (this.PlayerManager.Action) { case ActionType.Teetering: case ActionType.IdlePlay: case ActionType.IdleSleep: case ActionType.IdleLookAround: case ActionType.IdleYawn: case ActionType.Idle: case ActionType.Walking: case ActionType.Running: case ActionType.Sliding: if (!this.PlayerManager.Grounded || (double)this.InputManager.Movement.X == 0.0 || this.PlayerManager.LookingDirection == HorizontalDirection.None) { break; } TrileInstance trileInstance = this.PlayerManager.WallCollision.NearLow.Destination; if (trileInstance == null || !ActorTypeExtensions.IsPickable(trileInstance.Trile.ActorSettings.Type) || (trileInstance.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.AllSides || trileInstance.Hidden) || (trileInstance.PhysicsState == null || !trileInstance.PhysicsState.Grounded)) { break; } NearestTriles nearestTriles = this.LevelManager.NearestTrile(trileInstance.Position); if (nearestTriles.Surface != null && nearestTriles.Surface.Trile.ForceHugging || (double)Math.Abs(trileInstance.Center.Y - this.PlayerManager.Position.Y) > 0.5 || trileInstance.Trile.ActorSettings.Type == ActorType.Couch && FezMath.OrientationFromPhi(FezMath.ToPhi(trileInstance.Trile.ActorSettings.Face) + trileInstance.Phi) != FezMath.VisibleOrientation(FezMath.GetRotatedView(this.CameraManager.Viewpoint, this.PlayerManager.LookingDirection == HorizontalDirection.Right ? -1 : 1))) { break; } this.PlayerManager.Action = ActionType.Grabbing; this.PlayerManager.PushedInstance = trileInstance; break; } }
public override void Update(GameTime gameTime) { if (this.KeyboardState.GetKeyState(Keys.F1) == FezButtonState.Pressed) { this.GameState.DebugMode = true; } if (this.KeyboardState.GetKeyState(Keys.F2) == FezButtonState.Pressed) { this.GameState.DebugMode = false; } if (this.KeyboardState.GetKeyState(Keys.F3) == FezButtonState.Pressed) { this.SM.GlobalVolumeFactor = 0.0f; } if (this.KeyboardState.GetKeyState(Keys.F4) == FezButtonState.Pressed) { this.SM.GlobalVolumeFactor = 1f; } if (this.KeyboardState.GetKeyState(Keys.F5) == FezButtonState.Pressed) { this.GameState.ShowDebuggingBag = true; } if (this.KeyboardState.GetKeyState(Keys.F6) == FezButtonState.Pressed) { this.GameState.ShowDebuggingBag = false; } if (this.KeyboardState.GetKeyState(Keys.F9) == FezButtonState.Pressed) { this.TimeService.SetHour(4, true); } if (this.KeyboardState.GetKeyState(Keys.F10) == FezButtonState.Pressed) { this.TimeService.SetHour(12, true); } if (this.KeyboardState.GetKeyState(Keys.F11) == FezButtonState.Pressed) { this.TimeService.SetHour(20, true); } if (this.KeyboardState.GetKeyState(Keys.F12) == FezButtonState.Pressed) { this.TimeService.SetHour(0, true); } if (this.KeyboardState.GetKeyState(Keys.NumPad0) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D0) == FezButtonState.Pressed) { this.CameraManager.PixelsPerTrixel = 1f; } if (this.KeyboardState.GetKeyState(Keys.NumPad1) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D1) == FezButtonState.Pressed) { this.CameraManager.PixelsPerTrixel = 2f; } if (this.KeyboardState.GetKeyState(Keys.NumPad2) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D2) == FezButtonState.Pressed) { this.CameraManager.PixelsPerTrixel = 3f; } if (this.KeyboardState.GetKeyState(Keys.NumPad3) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D3) == FezButtonState.Pressed) { this.CameraManager.PixelsPerTrixel = 4f; } if (this.KeyboardState.GetKeyState(Keys.NumPad5) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D5) == FezButtonState.Pressed) { ++this.GameState.SaveData.CubeShards; this.GameState.SaveData.ScoreDirty = true; this.GameState.OnHudElementChanged(); } if ((this.KeyboardState.GetKeyState(Keys.NumPad6) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D6) == FezButtonState.Pressed) && this.GameState.SaveData.CubeShards > 0) { --this.GameState.SaveData.CubeShards; this.GameState.SaveData.ScoreDirty = true; this.GameState.OnHudElementChanged(); } if (this.KeyboardState.GetKeyState(Keys.NumPad7) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D7) == FezButtonState.Pressed) { ++this.GameState.SaveData.Keys; this.GameState.OnHudElementChanged(); } if ((this.KeyboardState.GetKeyState(Keys.NumPad8) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D8) == FezButtonState.Pressed) && this.GameState.SaveData.Keys > 0) { --this.GameState.SaveData.Keys; this.GameState.OnHudElementChanged(); } if (this.KeyboardState.GetKeyState(Keys.NumPad9) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D9) == FezButtonState.Pressed) { ++this.GameState.SaveData.SecretCubes; this.GameState.SaveData.ScoreDirty = true; this.GameState.OnHudElementChanged(); } if (this.KeyboardState.GetKeyState(Keys.L) == FezButtonState.Pressed) { this.GameState.SaveData.HasDoneHeartReboot = true; } if (FezButtonStateExtensions.IsDown(this.KeyboardState.GetKeyState(Keys.LeftControl)) && this.KeyboardState.GetKeyState(Keys.S) == FezButtonState.Pressed) { this.GameState.SaveData.IsNew = false; this.GameState.Save(); } if (this.KeyboardState.GetKeyState(Keys.H) == FezButtonState.Pressed) { this.BlackHoles.EnableAll(); } if (this.KeyboardState.GetKeyState(Keys.J) == FezButtonState.Pressed) { this.BlackHoles.DisableAll(); } if (this.KeyboardState.GetKeyState(Keys.K) == FezButtonState.Pressed) { this.BlackHoles.Randomize(); } if (!Fez.LongScreenshot) { return; } if (this.KeyboardState.GetKeyState(Keys.R) == FezButtonState.Pressed) { this.SM.PlayNewSong((string)null); this.GameState.HideHUD = true; this.PlayerManager.Action = ActionType.StandWinking; this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, Fez.DoubleRotations ? 2 : 1)); } if (this.KeyboardState.GetKeyState(Keys.T) != FezButtonState.Pressed) { return; } // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type DebugControls.\u003C\u003Ec__DisplayClass5 cDisplayClass5_1 = new DebugControls.\u003C\u003Ec__DisplayClass5(); // ISSUE: reference to a compiler-generated field cDisplayClass5_1.\u003C\u003E4__this = this; this.SM.KillSounds(0.1f); this.SM.PlayNewSong((string)null, 0.1f); foreach (AmbienceTrack ambienceTrack in (IEnumerable <AmbienceTrack>) this.LevelManager.AmbienceTracks) { this.SM.MuteAmbience(ambienceTrack.Name, 0.1f); } if (this.pl != null) { ServiceHelper.RemoveComponent <PolytronLogo>(this.pl); } DebugControls debugControls = this; PolytronLogo polytronLogo1 = new PolytronLogo(this.Game); polytronLogo1.DrawOrder = 10000; polytronLogo1.Opacity = 1f; PolytronLogo polytronLogo2 = polytronLogo1; debugControls.pl = polytronLogo2; ServiceHelper.AddComponent((IGameComponent)this.pl); // ISSUE: variable of a compiler-generated type DebugControls.\u003C\u003Ec__DisplayClass5 cDisplayClass5_2 = cDisplayClass5_1; LogoRenderer logoRenderer1 = new LogoRenderer(this.Game); logoRenderer1.DrawOrder = 9999; logoRenderer1.Visible = false; logoRenderer1.Enabled = false; LogoRenderer logoRenderer2 = logoRenderer1; // ISSUE: reference to a compiler-generated field cDisplayClass5_2.tl = logoRenderer2; // ISSUE: reference to a compiler-generated field ServiceHelper.AddComponent((IGameComponent)cDisplayClass5_1.tl); // ISSUE: reference to a compiler-generated field ServiceHelper.AddComponent((IGameComponent)(cDisplayClass5_1.FezLogo = new FezLogo(this.Game))); SoundEffect soundEffect = this.CMProvider.Global.Load <SoundEffect>("Sounds/Intro/LogoZoom"); // ISSUE: reference to a compiler-generated field cDisplayClass5_1.FezLogo.Visible = true; // ISSUE: reference to a compiler-generated field cDisplayClass5_1.FezLogo.Enabled = true; // ISSUE: reference to a compiler-generated field cDisplayClass5_1.FezLogo.TransitionStarted = true; // ISSUE: reference to a compiler-generated field cDisplayClass5_1.FezLogo.Opacity = 1f; // ISSUE: reference to a compiler-generated field cDisplayClass5_1.FezLogo.Inverted = true; // ISSUE: reference to a compiler-generated field cDisplayClass5_1.FezLogo.SinceStarted = 4.5f; // ISSUE: reference to a compiler-generated field cDisplayClass5_1.FezLogo.HalfSpeed = true; // ISSUE: reference to a compiler-generated field cDisplayClass5_1.FezLogo.Update(new GameTime()); SoundEffectExtensions.Emit(soundEffect); SoundManager.NoMoreSounds = true; this.GameState.SkipRendering = true; // ISSUE: reference to a compiler-generated method Waiters.Wait(7.0, new Action(cDisplayClass5_1.\u003CUpdate\u003Eb__2)); }
public void Update(TimeSpan elapsed) { if (this.ArtObject.ActorSettings.Inactive && this.State == SpinBlocksHost.SpinState.Idle) { return; } this.SinceChanged += elapsed; switch (this.State) { case SpinBlocksHost.SpinState.Idle: if (this.SinceChanged.TotalSeconds < (double)this.ArtObject.ActorSettings.SpinEvery - 0.5 - 0.100000001490116) { break; } this.OriginalRotation = this.ArtObject.Rotation; this.SinceChanged -= TimeSpan.FromSeconds((double)this.ArtObject.ActorSettings.SpinEvery - 0.5 - 0.100000001490116); this.State = SpinBlocksHost.SpinState.Warning; Vector3 right = this.CameraManager.InverseView.Right; Vector3 interpolatedCenter = this.CameraManager.InterpolatedCenter; float num1 = new Vector2() { X = FezMath.Dot(this.ArtObject.Position - interpolatedCenter, right), Y = (interpolatedCenter.Y - this.ArtObject.Position.Y) }.Length(); if (((double)num1 > 10.0 ? 0.600000023841858 / (((double)num1 - 10.0) / 5.0 + 1.0) : 1.0 - (double)Easing.EaseIn((double)num1 / 10.0, EasingType.Quadratic) * 0.400000005960464) <= 0.0500000007450581) { break; } this.Emitter = SoundEffectExtensions.EmitAt(this.SoundEffect, this.ArtObject.Position, RandomHelper.Centered(0.0799999982118607)); if (!this.IsRotato) { break; } this.Emitter.PauseViewTransitions = false; break; case SpinBlocksHost.SpinState.Warning: Quaternion fromAxisAngle1 = Quaternion.CreateFromAxisAngle(FezMath.ForwardVector(this.ArtObject.ActorSettings.SpinView), (float)(-1.57079637050629 * Math.Sin(FezMath.Saturate(this.SinceChanged.TotalSeconds / 0.100000001490116) * 0.785398185253143) * 0.100000001490116)); this.ArtObject.Rotation = fromAxisAngle1 * this.OriginalRotation; this.ArtObject.Position = this.OriginalPosition + Vector3.Transform(-this.RotationOffset, this.SpinAccumulatedRotation * fromAxisAngle1) + this.RotationOffset; if (this.SinceChanged.TotalSeconds < 0.100000001490116) { break; } this.SinceChanged -= TimeSpan.FromSeconds(0.100000001490116); this.State = SpinBlocksHost.SpinState.Spinning; break; case SpinBlocksHost.SpinState.Spinning: double num2 = FezMath.Saturate(this.SinceChanged.TotalSeconds / 0.5); float num3 = this.IsRotato ? Easing.EaseInOut(FezMath.Saturate(num2 / 0.75), EasingType.Quartic, EasingType.Quadratic) : Easing.EaseIn(num2 < 0.75 ? num2 / 0.75 : 1.0 + Math.Sin((num2 - 0.75) / 0.25 * 6.28318548202515) * 0.0149999996647239, EasingType.Quintic); bool flag1 = this.PlayerManager.Grounded && this.Triles.Contains(this.PlayerManager.Ground.First); if (flag1) { if (!this.IsRotato) { IPlayerManager playerManager = this.PlayerManager; Vector3 vector3 = playerManager.Velocity + FezMath.RightVector(this.ArtObject.ActorSettings.SpinView) * num3 * 0.1f; playerManager.Velocity = vector3; if ((double)num3 > 0.25) { this.PlayerManager.Position -= 0.01f * Vector3.UnitY; } } else if ((double)num3 > 0.0 && !this.hasRotated) { this.PlayerManager.IsOnRotato = true; this.Rotate(); this.OriginalPlayerPosition = this.PlayerManager.Position; this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, this.ArtObject.ActorSettings.SpinView == Viewpoint.Up ? 1 : -1), 0.5f); this.hasRotated = true; } } if (!this.IsRotato) { foreach (TrileInstance trileInstance in this.Triles) { trileInstance.Enabled = (double)num3 <= 0.25; } } bool flag2 = ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) && this.Triles.Contains(this.PlayerManager.HeldInstance); if (flag2) { if (!this.IsRotato) { IPlayerManager playerManager = this.PlayerManager; Vector3 vector3 = playerManager.Velocity + FezMath.RightVector(this.ArtObject.ActorSettings.SpinView) * num3 * 0.1f; playerManager.Velocity = vector3; if ((double)num3 > 0.25) { this.PlayerManager.Action = ActionType.Falling; this.PlayerManager.HeldInstance = (TrileInstance)null; } } else if ((double)num3 > 0.0 && (double)num3 < 0.5 && !this.hasRotated) { this.PlayerManager.IsOnRotato = true; this.Rotate(); this.OriginalPlayerPosition = this.PlayerManager.Position; this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, this.ArtObject.ActorSettings.SpinView == Viewpoint.Up ? 1 : -1), 0.5f); this.hasRotated = true; } } this.TrixelParticleSystems.PropagateEnergy(this.ArtObject.Position - FezMath.RightVector(this.ArtObject.ActorSettings.SpinView), num3 * 0.1f); Quaternion fromAxisAngle2 = Quaternion.CreateFromAxisAngle(FezMath.ForwardVector(this.ArtObject.ActorSettings.SpinView), (float)(1.57079637050629 * (double)num3 * 1.10000002384186 - 0.157079637050629)); this.ArtObject.Rotation = fromAxisAngle2 * this.OriginalRotation; this.ArtObject.Position = this.OriginalPosition + Vector3.Transform(-this.RotationOffset, this.SpinAccumulatedRotation * fromAxisAngle2) + this.RotationOffset; if (this.IsRotato && (flag1 || flag2)) { Vector3 vector3 = this.ArtObject.ActorSettings.RotationCenter; if (!this.ArtObject.ActorSettings.OffCenter) { vector3 = this.ArtObject.Position; } this.PlayerManager.Position = Vector3.Transform(this.OriginalPlayerPosition - vector3, fromAxisAngle2) + vector3; } if (this.SinceChanged.TotalSeconds < 0.5) { break; } foreach (TrileInstance trileInstance in this.Triles) { trileInstance.Enabled = true; } if ((!this.IsRotato || !this.hasRotated) && (double)this.Triles.Count != (double)this.ArtObject.ArtObject.Size.X * (double)this.ArtObject.ArtObject.Size.Y * (double)this.ArtObject.ArtObject.Size.Z) { this.Rotate(); } this.SpinAccumulatedRotation = this.SpinAccumulatedRotation * fromAxisAngle2; this.State = SpinBlocksHost.SpinState.Idle; this.hasRotated = false; this.SinceChanged -= TimeSpan.FromSeconds(0.5); this.PlayerManager.IsOnRotato = false; break; } }
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; } Vector3 b1 = FezMath.SideMask(this.CameraManager.Viewpoint); Vector3 depthMask = FezMath.DepthMask(this.CameraManager.Viewpoint); Vector3 vector3_1 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); if (this.RightPositions == 8) { bool flag = false; foreach (TrileInstance instance in this.Blocks) { if (!flag) { ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, instance, NameOfGodPuzzleHost.PuzzleCenter + Vector3.UnitY * 2f + Vector3.UnitZ) { FlashOnSpawn = true, ActorToSpawn = ActorType.PieceOfHeart }); flag = true; } else { ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, instance)); } } this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(0); foreach (Volume volume in Enumerable.Where <Volume>((IEnumerable <Volume>) this.LevelManager.Volumes.Values, (Func <Volume, bool>)(x => { if (x.ActorSettings != null && x.ActorSettings.IsPointOfInterest) { return(x.Enabled); } else { return(false); } }))) { volume.Enabled = false; this.GameState.SaveData.ThisLevel.InactiveVolumes.Add(volume.Id); } this.LevelService.ResolvePuzzle(); this.Enabled = false; } else { this.RightPositions = 0; Vector3 b2 = FezMath.RightVector(this.CameraManager.Viewpoint); foreach (TrileInstance trileInstance1 in this.Blocks) { float num = FezMath.Dot(trileInstance1.Center, b2); trileInstance1.LastTreasureSin = 0.0f; foreach (TrileInstance trileInstance2 in this.Blocks) { if (trileInstance2 != trileInstance1 && (double)num > (double)FezMath.Dot(trileInstance2.Center, b2)) { ++trileInstance1.LastTreasureSin; } } } using (List <TrileInstance> .Enumerator enumerator = this.Blocks.GetEnumerator()) { while (enumerator.MoveNext()) { TrileInstance instance = enumerator.Current; if (!instance.PhysicsState.Background && instance.Enabled && ((double)instance.Position.Y >= 57.0 && (double)instance.Position.Y < 57.75) && (this.PlayerManager.HeldInstance != instance && this.PlayerManager.PushedInstance != instance && instance.PhysicsState.Grounded) && instance.PhysicsState.Ground.First != this.PlayerManager.PushedInstance) { Vector3 vector3_2 = Vector3.Min(Vector3.Max(FezMath.Round((instance.Center - NameOfGodPuzzleHost.PuzzleCenter) / 1f), new Vector3(-8f, 0.0f, -8f)), new Vector3(8f, 1f, 8f)); Vector3 vector3_3 = NameOfGodPuzzleHost.PuzzleCenter + vector3_2 * 1f; Vector3 vector3_4 = (vector3_3 - instance.Center) * FezMath.XZMask; float num1 = Math.Max(vector3_4.Length(), 0.1f); instance.PhysicsState.Velocity += 0.25f * vector3_4 / num1 * (float)gameTime.ElapsedGameTime.TotalSeconds; if ((double)num1 <= 0.100000001490116 && (double)vector3_2.Y == 0.0 && instance != this.PlayerManager.Ground.First && !Enumerable.Any <TrileInstance>((IEnumerable <TrileInstance>) this.Blocks, (Func <TrileInstance, bool>)(x => x.PhysicsState.Ground.First == instance)) && Enumerable.Any <TrileInstance>((IEnumerable <TrileInstance>) this.Blocks, (Func <TrileInstance, bool>)(b => { if (b != instance && FezMath.AlmostEqual(b.Position.Y, instance.Position.Y)) { return((double)Math.Abs(FezMath.Dot(b.Center - instance.Center, depthMask)) < 1.0); } else { return(false); } }))) { instance.Enabled = false; for (int index = 0; index < NameOfGodPuzzleHost.SpiralTraversal.Length; ++index) { int num2 = NameOfGodPuzzleHost.SpiralTraversal[index]; NearestTriles nearestTriles = this.LevelManager.NearestTrile(NameOfGodPuzzleHost.PuzzleCenter + (float)num2 * 1f * depthMask, QueryOptions.None, new Viewpoint?(FezMath.GetRotatedView(this.CameraManager.Viewpoint, 1))); if (nearestTriles.Deep == null) { nearestTriles.Deep = this.LevelManager.NearestTrile(NameOfGodPuzzleHost.PuzzleCenter + (float)num2 * 1f * depthMask - depthMask * 0.5f, QueryOptions.None, new Viewpoint?(FezMath.GetRotatedView(this.CameraManager.Viewpoint, 1))).Deep; } if (nearestTriles.Deep == null) { nearestTriles.Deep = this.LevelManager.NearestTrile(NameOfGodPuzzleHost.PuzzleCenter + (float)num2 * 1f * depthMask + depthMask * 0.5f, QueryOptions.None, new Viewpoint?(FezMath.GetRotatedView(this.CameraManager.Viewpoint, 1))).Deep; } if (nearestTriles.Deep == null) { vector3_3 = instance.PhysicsState.Center = vector3_1 * instance.PhysicsState.Center + NameOfGodPuzzleHost.PuzzleCenter * depthMask + depthMask * (float)num2 * 1f; break; } } instance.Enabled = true; } if ((double)Math.Abs(vector3_4.X) <= 1.0 / 64.0 && (double)Math.Abs(vector3_4.Y) <= 1.0 / 64.0) { instance.PhysicsState.Velocity = Vector3.Zero; instance.PhysicsState.Center = vector3_3; instance.PhysicsState.UpdateInstance(); this.LevelManager.UpdateInstance(instance); } if ((instance.PhysicsState.Ground.NearLow == null || instance.PhysicsState.Ground.NearLow.PhysicsState != null && (double)Math.Abs(FezMath.Dot(instance.PhysicsState.Ground.NearLow.Center - instance.Center, b1)) > 0.875) && (instance.PhysicsState.Ground.FarHigh == null || instance.PhysicsState.Ground.FarHigh.PhysicsState != null && (double)Math.Abs(FezMath.Dot(instance.PhysicsState.Ground.FarHigh.Center - instance.Center, b1)) > 0.875)) { instance.PhysicsState.Ground = new MultipleHits <TrileInstance>(); instance.PhysicsState.Center += Vector3.Down * 0.1f; } if (instance.PhysicsState.Grounded && instance.PhysicsState.Velocity == Vector3.Zero) { string cubemapPath = instance.Trile.CubemapPath; FaceOrientation o = FezMath.OrientationFromPhi(FezMath.ToPhi(this.CameraManager.Viewpoint) + instance.Phi); switch (o) { case FaceOrientation.Right: case FaceOrientation.Left: o = FezMath.GetOpposite(o); break; } int index = (int)MathHelper.Clamp(instance.LastTreasureSin, 0.0f, 7f); if (NameOfGodPuzzleHost.Slots[index].Face == o && NameOfGodPuzzleHost.Slots[index].TrileName == cubemapPath) { ++this.RightPositions; } } } } } } }