private static Vector3 GetIntemediateVector(Vector3 from, Vector3 to) { return((!FezMath.AlmostEqual(FezMath.AngleBetween(from, to), 3.141593f) ? FezMath.Slerp(from, to, 0.5f) : Vector3.Cross(Vector3.Normalize(to - from), Vector3.UnitY)) + Vector3.UnitY * 0.0f); }
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; } }