diff --git a/.gitignore b/.gitignore index b9d6bd9..57f3e77 100644 --- a/.gitignore +++ b/.gitignore @@ -213,3 +213,6 @@ pip-log.txt #Mr Developer .mr.developer.cfg + +_decomp/ +Content/ \ No newline at end of file diff --git a/FEZ/.vs/FEZ/DesignTimeBuild/.dtbcache.v2 b/FEZ/.vs/FEZ/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..731ae96 Binary files /dev/null and b/FEZ/.vs/FEZ/DesignTimeBuild/.dtbcache.v2 differ diff --git a/FEZ/.vs/FEZ/FileContentIndex/62e6c4c9-4517-4a24-815f-942a08bc68aa.vsidx b/FEZ/.vs/FEZ/FileContentIndex/62e6c4c9-4517-4a24-815f-942a08bc68aa.vsidx new file mode 100644 index 0000000..c4abc12 Binary files /dev/null and b/FEZ/.vs/FEZ/FileContentIndex/62e6c4c9-4517-4a24-815f-942a08bc68aa.vsidx differ diff --git a/FEZ/.vs/FEZ/v17/.futdcache.v2 b/FEZ/.vs/FEZ/v17/.futdcache.v2 new file mode 100644 index 0000000..8c5c0f7 Binary files /dev/null and b/FEZ/.vs/FEZ/v17/.futdcache.v2 differ diff --git a/FEZ/.vs/ProjectEvaluation/fez.metadata.v7.bin b/FEZ/.vs/ProjectEvaluation/fez.metadata.v7.bin new file mode 100644 index 0000000..c9dc5d7 Binary files /dev/null and b/FEZ/.vs/ProjectEvaluation/fez.metadata.v7.bin differ diff --git a/FEZ/.vs/ProjectEvaluation/fez.projects.v7.bin b/FEZ/.vs/ProjectEvaluation/fez.projects.v7.bin new file mode 100644 index 0000000..712340a Binary files /dev/null and b/FEZ/.vs/ProjectEvaluation/fez.projects.v7.bin differ diff --git a/FEZ/AssemblyInfo.cs b/FEZ/AssemblyInfo.cs deleted file mode 100644 index 71da6c9..0000000 --- a/FEZ/AssemblyInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyProduct("FezGame")] -[assembly: AssemblyCompany("")] -[assembly: ComVisible(false)] -[assembly: Extension] -[assembly: AssemblyTitle("FezGame")] -[assembly: AssemblyCopyright("Copyright © 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyDescription("")] -[assembly: Guid("ce249f48-c866-4bde-a5e6-b63258f43781")] -[assembly: AssemblyVersion("1.0.0.0")] diff --git a/FEZ/Components/AchievementSellScreen.cs b/FEZ/Components/AchievementSellScreen.cs deleted file mode 100644 index fc641c6..0000000 --- a/FEZ/Components/AchievementSellScreen.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Type: FezGame.Components.AchievementSellScreen -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine.Components; -using FezEngine.Services; -using FezEngine.Structure.Input; -using FezEngine.Tools; -using FezGame.Services; -using FezGame.Tools; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.GamerServices; -using Microsoft.Xna.Framework.Graphics; -using System; - -namespace FezGame.Components -{ - public class AchievementSellScreen : DrawableGameComponent - { - private static readonly TimeSpan TransitionDuration = TimeSpan.FromSeconds(0.5); - private readonly Achievement achievement; - private Texture2D black; - private SpriteBatch SpriteBatch; - private TimeSpan sinceTransition; - private Action nextAction; - private GlyphTextRenderer tr; - private bool fadeInComplete; - - [ServiceDependency] - public ISoundManager SoundManager { private get; set; } - - [ServiceDependency] - public IInputManager InputManager { private get; set; } - - [ServiceDependency] - public IGameStateManager GameState { private get; set; } - - [ServiceDependency] - public ITargetRenderingManager TargetRenderer { private get; set; } - - [ServiceDependency] - public IFontManager Fonts { private get; set; } - - [ServiceDependency] - public IContentManagerProvider CMProvider { private get; set; } - - static AchievementSellScreen() - { - } - - public AchievementSellScreen(Game game, Achievement achievement) - : base(game) - { - this.achievement = achievement; - this.UpdateOrder = -1; - this.DrawOrder = 1002; - } - - public override void Initialize() - { - this.GameState.InCutscene = true; - this.GameState.DynamicUpgrade += new Action(this.BackToGame); - base.Initialize(); - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - this.GameState.DynamicUpgrade -= new Action(this.BackToGame); - } - - protected override void LoadContent() - { - base.LoadContent(); - this.SpriteBatch = new SpriteBatch(this.GraphicsDevice); - this.tr = new GlyphTextRenderer(this.Game); - this.black = this.CMProvider.Global.Load("Other Textures/FullBlack"); - } - - public override void Update(GameTime gameTime) - { - if (this.InputManager.GrabThrow == FezButtonState.Pressed) - this.UnlockFullGame(); - if (this.InputManager.Jump == FezButtonState.Pressed) - { - this.sinceTransition = TimeSpan.Zero; - this.nextAction = new Action(this.BackToGame); - } - if (!(this.sinceTransition < AchievementSellScreen.TransitionDuration)) - return; - this.sinceTransition += gameTime.ElapsedGameTime; - if (!(this.sinceTransition >= AchievementSellScreen.TransitionDuration)) - return; - if (!this.fadeInComplete) - this.fadeInComplete = true; - else - this.nextAction(); - } - - private void BackToGame() - { - this.GameState.InCutscene = false; - this.SoundManager.Resume(); - ServiceHelper.RemoveComponent(this); - } - - private void UnlockFullGame() - { - } - - public override void Draw(GameTime gameTime) - { - float num1 = FezMath.Saturate((float) this.sinceTransition.Ticks / (float) AchievementSellScreen.TransitionDuration.Ticks); - Vector2 vector2 = new Vector2((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height); - float alpha = !this.fadeInComplete ? num1 : (this.nextAction != null ? 1f - num1 : 1f); - this.TargetRenderer.DrawFullscreen(new Color(1f, 1f, 1f, alpha * 0.25f)); - GraphicsDeviceExtensions.BeginPoint(this.SpriteBatch); - this.SpriteBatch.Draw(this.black, new Rectangle(0, (int) ((double) vector2.Y / 2.0 - (double) vector2.Y / 4.0), (int) vector2.X, (int) ((double) vector2.Y / 2.0)), new Color(0.0f, 0.0f, 0.0f, alpha * 0.9f)); - this.tr.DrawCenteredString(this.SpriteBatch, this.Fonts.Big, StaticText.GetString("AchievementInTrialTitle"), new Color(1f, 1f, 1f, alpha), new Vector2(0.0f, (float) ((double) vector2.Y / 2.0 - 100.0)), this.Fonts.BigFactor); - this.tr.DrawCenteredString(this.SpriteBatch, this.Fonts.Small, StaticText.GetString("AchievementInTrialText"), new Color(1f, 1f, 1f, alpha), new Vector2(0.0f, vector2.Y / 2f), this.Fonts.SmallFactor); - this.tr.DrawCenteredString(this.SpriteBatch, this.Fonts.Small, StaticText.GetString("AchievementInTrialSellText"), new Color(1f, 1f, 1f, alpha), new Vector2(0.0f, (float) ((double) vector2.Y / 2.0 + 40.0)), this.Fonts.SmallFactor); - float num2 = this.Fonts.Small.MeasureString(StaticText.GetString("AchievementInTrialResume")).X * this.Fonts.SmallFactor; - this.tr.DrawShadowedText(this.SpriteBatch, this.Fonts.Small, StaticText.GetString("AchievementInTrialResume"), new Vector2(vector2.X - this.tr.Margin.X - num2, (float) ((double) vector2.Y / 2.0 + 125.0)), new Color(0.5f, 1f, 0.5f, alpha), this.Fonts.SmallFactor); - this.SpriteBatch.End(); - } - } -} diff --git a/FEZ/Components/Actions/BellActions.cs b/FEZ/Components/Actions/BellActions.cs deleted file mode 100644 index e902ee6..0000000 --- a/FEZ/Components/Actions/BellActions.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Type: FezGame.Components.Actions.BellActions -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezGame.Structure; -using Microsoft.Xna.Framework; -using System; - -namespace FezGame.Components.Actions -{ - internal class BellActions : PlayerAction - { - protected override bool ViewTransitionIndependent - { - get - { - return true; - } - } - - public BellActions(Game game) - : base(game) - { - } - - protected override bool Act(TimeSpan elapsed) - { - if (this.PlayerManager.Action == ActionType.TurnToBell && this.PlayerManager.Animation.Timing.Ended) - { - this.PlayerManager.Action = ActionType.HitBell; - this.PlayerManager.Animation.Timing.Restart(); - } - if (this.PlayerManager.Action == ActionType.HitBell && this.PlayerManager.Animation.Timing.Ended) - { - this.PlayerManager.Action = ActionType.TurnAwayFromBell; - this.PlayerManager.Animation.Timing.Restart(); - } - if (this.PlayerManager.Action == ActionType.TurnAwayFromBell && this.PlayerManager.Animation.Timing.Ended) - { - this.PlayerManager.Action = ActionType.Idle; - this.PlayerManager.Animation.Timing.Restart(); - } - this.PlayerManager.Background = false; - return true; - } - - protected override bool IsActionAllowed(ActionType type) - { - if (type != ActionType.TurnAwayFromBell && type != ActionType.HitBell) - return type == ActionType.TurnToBell; - else - return true; - } - } -} diff --git a/FEZ/Components/Actions/Bounce.cs b/FEZ/Components/Actions/Bounce.cs deleted file mode 100644 index 2b4a02a..0000000 --- a/FEZ/Components/Actions/Bounce.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Type: FezGame.Components.Actions.Bounce -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine.Structure; -using FezEngine.Structure.Input; -using FezEngine.Tools; -using FezGame.Services; -using FezGame.Structure; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using System; - -namespace FezGame.Components.Actions -{ - public class Bounce : PlayerAction - { - private static readonly TimeSpan BounceVibrateTime = TimeSpan.FromSeconds(0.300000011920929); - private const float BouncerResponse = 0.32f; - private SoundEffect bounceHigh; - private SoundEffect bounceLow; - - static Bounce() - { - } - - public Bounce(Game game) - : base(game) - { - } - - protected override void LoadContent() - { - this.bounceHigh = this.CMProvider.Global.Load("Sounds/Gomez/BounceHigh"); - this.bounceLow = this.CMProvider.Global.Load("Sounds/Gomez/BounceLow"); - } - - 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.Jumping: - case ActionType.Falling: - case ActionType.Dropping: - case ActionType.Sliding: - case ActionType.Landing: - if (!this.PlayerManager.Grounded || this.PlayerManager.Ground.First.Trile.ActorSettings.Type != ActorType.Bouncer) - break; - this.PlayerManager.Action = ActionType.Bouncing; - break; - } - } - - protected override void Begin() - { - base.Begin(); - this.InputManager.ActiveGamepad.Vibrate(VibrationMotor.LeftLow, 0.5, Bounce.BounceVibrateTime, EasingType.Quadratic); - this.InputManager.ActiveGamepad.Vibrate(VibrationMotor.RightHigh, 0.600000023841858, Bounce.BounceVibrateTime, EasingType.Quadratic); - if (RandomHelper.Probability(0.5)) - SoundEffectExtensions.EmitAt(this.bounceHigh, this.PlayerManager.Position); - else - SoundEffectExtensions.EmitAt(this.bounceLow, this.PlayerManager.Position); - IPlayerManager playerManager1 = this.PlayerManager; - Vector3 vector3_1 = playerManager1.Velocity * new Vector3(1f, 0.0f, 1f); - playerManager1.Velocity = vector3_1; - IPlayerManager playerManager2 = this.PlayerManager; - Vector3 vector3_2 = playerManager2.Velocity + Vector3.UnitY * 0.32f; - playerManager2.Velocity = vector3_2; - } - - protected override bool IsActionAllowed(ActionType type) - { - return type == ActionType.Bouncing; - } - } -} diff --git a/FEZ/Components/Actions/Carry.cs b/FEZ/Components/Actions/Carry.cs deleted file mode 100644 index be33649..0000000 --- a/FEZ/Components/Actions/Carry.cs +++ /dev/null @@ -1,239 +0,0 @@ -// Type: FezGame.Components.Actions.Carry -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine; -using FezEngine.Structure; -using FezEngine.Structure.Input; -using FezEngine.Tools; -using FezGame.Services; -using FezGame.Structure; -using FezGame.Tools; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using System; - -namespace FezGame.Components.Actions -{ - public class Carry : PlayerAction - { - private static readonly Vector2[] LightWalkOffset = new Vector2[8] - { - new Vector2(0.0f, 0.0f), - new Vector2(0.0f, 2f), - new Vector2(0.0f, 3f), - new Vector2(0.0f, 2f), - new Vector2(0.0f, -1f), - new Vector2(0.0f, 2f), - new Vector2(0.0f, 3f), - new Vector2(0.0f, 2f) - }; - private static readonly Vector2[] HeavyWalkOffset = new Vector2[8] - { - new Vector2(0.0f, -1f), - new Vector2(0.0f, -3f), - new Vector2(0.0f, -2f), - new Vector2(0.0f, 0.0f), - new Vector2(0.0f, -1f), - new Vector2(0.0f, -3f), - new Vector2(0.0f, -2f), - new Vector2(0.0f, 0.0f) - }; - private static readonly Vector2[] LightJumpOffset = new Vector2[8] - { - new Vector2(0.0f, -3f), - new Vector2(-1f, 3f), - new Vector2(0.0f, 2f), - new Vector2(0.0f, -2f), - new Vector2(0.0f, 0.0f), - new Vector2(0.0f, 2f), - new Vector2(0.0f, -3f), - new Vector2(0.0f, -2f) - }; - private static readonly Vector2[] HeavyJumpOffset = new Vector2[8] - { - new Vector2(-1f, -3f), - new Vector2(0.0f, 3f), - new Vector2(0.0f, 2f), - new Vector2(0.0f, 0.0f), - new Vector2(0.0f, 0.0f), - new Vector2(0.0f, 3f), - new Vector2(-1f, 3f), - new Vector2(-1f, -3f) - }; - private readonly MovementHelper movementHelper = new MovementHelper(4.086957f, 0.0f, float.MaxValue); - private const float CarryJumpStrength = 0.885f; - private const float CarryWalkSpeed = 4.086957f; - private const float CarryHeavyWalkSpeed = 2.35f; - private SoundEffect jumpSound; - private SoundEffect landSound; - private bool jumpIsFall; - private bool wasNotGrounded; - - static Carry() - { - } - - public Carry(Game game) - : base(game) - { - } - - public override void Initialize() - { - base.Initialize(); - this.movementHelper.Entity = (IPhysicsEntity) this.PlayerManager; - } - - protected override void LoadContent() - { - base.LoadContent(); - this.jumpSound = this.CMProvider.Global.Load("Sounds/Gomez/Jump"); - this.landSound = this.CMProvider.Global.Load("Sounds/Gomez/Land"); - } - - protected override void TestConditions() - { - switch (this.PlayerManager.Action) - { - case ActionType.CarryIdle: - case ActionType.CarryWalk: - case ActionType.CarryJump: - case ActionType.CarrySlide: - case ActionType.CarryHeavyIdle: - case ActionType.CarryHeavyWalk: - case ActionType.CarryHeavyJump: - case ActionType.CarryHeavySlide: - if (this.PlayerManager.CarriedInstance == null) - break; - bool isLight = ActorTypeExtensions.IsLight(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type); - bool flag1 = this.PlayerManager.Action == ActionType.CarryHeavyJump || this.PlayerManager.Action == ActionType.CarryJump; - bool flag2 = flag1 && !this.PlayerManager.Animation.Timing.Ended; - if (this.PlayerManager.Grounded && this.InputManager.Jump == FezButtonState.Pressed && FezButtonStateExtensions.IsDown(this.InputManager.Down) && this.PlayerManager.Ground.First.GetRotatedFace(this.CameraManager.VisibleOrientation) == CollisionType.TopOnly) - { - this.PlayerManager.Position -= Vector3.UnitY * this.CollisionManager.DistanceEpsilon * 2f; - IPlayerManager playerManager = this.PlayerManager; - Vector3 vector3 = playerManager.Velocity - 0.0075f * Vector3.UnitY; - playerManager.Velocity = vector3; - this.PlayerManager.Action = isLight ? ActionType.CarryJump : ActionType.CarryHeavyJump; - this.PlayerManager.CanDoubleJump = false; - break; - } - else if ((this.PlayerManager.Grounded || this.PlayerManager.CanDoubleJump) && (!flag1 || this.PlayerManager.Animation.Timing.Frame != 0) && this.InputManager.Jump == FezButtonState.Pressed) - { - this.jumpIsFall = false; - this.Jump(isLight); - break; - } - else if (this.PlayerManager.Grounded && (double) this.InputManager.Movement.X != 0.0 && !flag2) - { - this.PlayerManager.Action = isLight ? ActionType.CarryWalk : ActionType.CarryHeavyWalk; - break; - } - else - { - if (this.PlayerManager.Action != ActionType.CarryHeavyJump && this.PlayerManager.Action != ActionType.CarryJump && !this.PlayerManager.Grounded) - { - this.jumpIsFall = true; - this.PlayerManager.Action = isLight ? ActionType.CarryJump : ActionType.CarryHeavyJump; - } - if (this.wasNotGrounded && this.PlayerManager.Grounded) - SoundEffectExtensions.EmitAt(this.landSound, this.PlayerManager.Position); - this.wasNotGrounded = !this.PlayerManager.Grounded; - if (this.PlayerManager.Action != ActionType.CarryIdle && this.PlayerManager.Action != ActionType.CarryHeavyIdle && (this.PlayerManager.Grounded && FezMath.AlmostEqual(FezMath.XZ(this.PlayerManager.Velocity), Vector2.Zero)) && !flag2) - { - this.PlayerManager.Action = isLight ? ActionType.CarryIdle : ActionType.CarryHeavyIdle; - break; - } - else - { - if (this.PlayerManager.Action == ActionType.CarrySlide || !this.PlayerManager.Grounded || (FezMath.AlmostEqual(FezMath.XZ(this.PlayerManager.Velocity), Vector2.Zero) || !FezMath.AlmostEqual(this.InputManager.Movement, Vector2.Zero)) || flag2) - break; - this.PlayerManager.Action = isLight ? ActionType.CarrySlide : ActionType.CarryHeavySlide; - this.PlayerManager.Animation.Timing.Paused = false; - break; - } - } - } - } - - protected override bool Act(TimeSpan elapsed) - { - if (this.PlayerManager.CarriedInstance == null) - { - this.PlayerManager.Action = ActionType.Idle; - return false; - } - else - { - bool flag = ActorTypeExtensions.IsLight(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type); - if (this.PlayerManager.Action == ActionType.CarryWalk || this.PlayerManager.Action == ActionType.CarryHeavyWalk || (this.PlayerManager.Action == ActionType.CarryHeavyJump || this.PlayerManager.Action == ActionType.CarryJump) && this.PlayerManager.Grounded) - { - this.movementHelper.WalkAcceleration = flag ? 4.086957f : 2.35f; - this.movementHelper.Update((float) elapsed.TotalSeconds); - } - float timeFactor = 1.2f; - if (this.PlayerManager.Action == ActionType.CarryJump || this.PlayerManager.Action == ActionType.CarryHeavyJump) - timeFactor = 1f; - this.PlayerManager.Animation.Timing.Update(elapsed, timeFactor); - if (this.PlayerManager.Action == ActionType.CarryJump || this.PlayerManager.Action == ActionType.CarryHeavyJump) - { - if (this.PlayerManager.Animation.Timing.Frame == 1 && this.PlayerManager.Grounded && !this.jumpIsFall) - { - SoundEffectExtensions.EmitAt(this.jumpSound, this.PlayerManager.Position); - IPlayerManager playerManager1 = this.PlayerManager; - Vector3 vector3_1 = playerManager1.Velocity * FezMath.XZMask; - playerManager1.Velocity = vector3_1; - IPlayerManager playerManager2 = this.PlayerManager; - Vector3 vector3_2 = playerManager2.Velocity + 0.13275f * Vector3.UnitY * (flag ? 1f : 0.75f); - playerManager2.Velocity = vector3_2; - } - else - this.JumpAftertouch((float) elapsed.TotalSeconds); - } - this.MoveCarriedInstance(); - return false; - } - } - - private void Jump(bool isLight) - { - this.PlayerManager.Action = isLight ? ActionType.CarryJump : ActionType.CarryHeavyJump; - this.PlayerManager.Animation.Timing.Restart(); - this.PlayerManager.CanDoubleJump = false; - } - - private void JumpAftertouch(float secondsElapsed) - { - int frame = this.PlayerManager.Animation.Timing.Frame; - int num = ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) ? 7 : 6; - if (!this.PlayerManager.Grounded && (double) this.PlayerManager.Velocity.Y < 0.0) - this.PlayerManager.Animation.Timing.Step = Math.Max(this.PlayerManager.Animation.Timing.Step, 0.5f); - if (frame != 0 && frame < num && this.PlayerManager.Grounded) - this.PlayerManager.Animation.Timing.Step = (float) num / 8f; - else if (!this.PlayerManager.Grounded && (double) this.PlayerManager.Velocity.Y < 0.0) - this.PlayerManager.Animation.Timing.Step = Math.Min(this.PlayerManager.Animation.Timing.Step, (float) ((double) num / 8.0 - 1.0 / 1000.0)); - else if (frame < num) - this.PlayerManager.Animation.Timing.Step = Math.Min(this.PlayerManager.Animation.Timing.Step, 0.499f); - if (frame == 0 || frame >= num || this.InputManager.Jump != FezButtonState.Down) - return; - IPlayerManager playerManager = this.PlayerManager; - Vector3 vector3 = playerManager.Velocity + (float) ((double) secondsElapsed * 0.884999990463257 / 4.0) * Vector3.UnitY; - playerManager.Velocity = vector3; - } - - protected override bool IsActionAllowed(ActionType type) - { - if (type != ActionType.CarryWalk && type != ActionType.CarryIdle && (type != ActionType.CarryJump && type != ActionType.CarrySlide) && (type != ActionType.CarryHeavyWalk && type != ActionType.CarryHeavyIdle && type != ActionType.CarryHeavyJump)) - return type == ActionType.CarryHeavySlide; - else - return true; - } - - private void MoveCarriedInstance() - { - // ISSUE: unable to decompile the method. - } - } -} diff --git a/FEZ/Components/Actions/ClimbLadder.cs b/FEZ/Components/Actions/ClimbLadder.cs deleted file mode 100644 index 8d9fe9f..0000000 --- a/FEZ/Components/Actions/ClimbLadder.cs +++ /dev/null @@ -1,339 +0,0 @@ -// Type: FezGame.Components.Actions.ClimbLadder -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine; -using FezEngine.Services; -using FezEngine.Structure; -using FezEngine.Structure.Input; -using FezEngine.Tools; -using FezGame.Services; -using FezGame.Structure; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using System; - -namespace FezGame.Components.Actions -{ - public class ClimbLadder : PlayerAction - { - private const float ClimbingSpeed = 0.425f; - private ClimbingApproach currentApproach; - private bool shouldSyncAnimationHalfway; - private TimeSpan sinceGrabbed; - private TrileInstance lastGrabbed; - private SoundEffect climbSound; - private int lastFrame; - - public ClimbLadder(Game game) - : base(game) - { - this.UpdateOrder = 1; - } - - protected override void LoadContent() - { - base.LoadContent(); - this.climbSound = this.CMProvider.Global.Load("Sounds/Gomez/ClimbLadder"); - } - - public override void Initialize() - { - this.CameraManager.ViewpointChanged += new Action(this.ChangeApproach); - base.Initialize(); - } - - private void ChangeApproach() - { - if (!this.IsActionAllowed(this.PlayerManager.Action) || !FezMath.IsOrthographic(this.CameraManager.Viewpoint) || (this.CameraManager.Viewpoint == this.CameraManager.LastViewpoint || this.PlayerManager.IsOnRotato)) - return; - int num = (int) (this.currentApproach + FezMath.GetDistance(this.CameraManager.Viewpoint, this.CameraManager.LastViewpoint)); - if (num > 4) - num -= 4; - if (num < 1) - num += 4; - this.currentApproach = (ClimbingApproach) num; - this.RefreshPlayerAction(); - this.RefreshPlayerDirection(); - this.shouldSyncAnimationHalfway = true; - } - - 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.LookingLeft: - case ActionType.LookingRight: - case ActionType.LookingUp: - case ActionType.LookingDown: - case ActionType.Walking: - case ActionType.Running: - case ActionType.Jumping: - case ActionType.Lifting: - case ActionType.Falling: - case ActionType.Bouncing: - case ActionType.Flying: - case ActionType.Dropping: - case ActionType.Sliding: - case ActionType.Landing: - TrileInstance trileInstance1 = this.IsOnLadder(out this.currentApproach); - if (this.currentApproach == ClimbingApproach.None) - break; - bool flag = false; - if (FezButtonStateExtensions.IsDown(this.InputManager.Down) && this.PlayerManager.Grounded) - { - TrileInstance trileInstance2 = this.LevelManager.NearestTrile(trileInstance1.Center - Vector3.UnitY).Surface; - flag = trileInstance2 != null && trileInstance2.Trile.ActorSettings.Type == ActorType.Ladder; - } - FezButtonState fezButtonState = this.PlayerManager.Grounded ? FezButtonState.Pressed : FezButtonState.Down; - if (!flag && this.InputManager.Up != fezButtonState && (this.PlayerManager.Grounded || this.currentApproach != ClimbingApproach.Left && this.currentApproach != ClimbingApproach.Right || Math.Sign(this.InputManager.Movement.X) != FezMath.Sign(ClimbingApproachExtensions.AsDirection(this.currentApproach))) || this.lastGrabbed != null && (trileInstance1 == this.lastGrabbed || trileInstance1.Position == this.lastGrabbed.Position + Vector3.UnitY || trileInstance1.Position == this.lastGrabbed.Position - Vector3.UnitY)) - break; - this.PlayerManager.HeldInstance = trileInstance1; - switch (this.currentApproach) - { - case ClimbingApproach.Right: - case ClimbingApproach.Left: - this.PlayerManager.NextAction = ActionType.SideClimbingLadder; - break; - case ClimbingApproach.Back: - this.PlayerManager.NextAction = ActionType.BackClimbingLadder; - break; - case ClimbingApproach.Front: - this.PlayerManager.NextAction = ActionType.FrontClimbingLadder; - break; - } - if (this.PlayerManager.Grounded) - { - ActionType actionType = this.currentApproach == ClimbingApproach.Back ? ActionType.IdleToClimb : (this.currentApproach == ClimbingApproach.Front ? ActionType.IdleToFrontClimb : (this.currentApproach == ClimbingApproach.Back ? ActionType.IdleToClimb : ActionType.IdleToSideClimb)); - if (this.CollisionManager.CollidePoint(this.GetDestination(), Vector3.Down, QueryOptions.None, 0.0f, this.CameraManager.Viewpoint).Collided) - { - this.WalkTo.Destination = new Func(this.GetDestination); - this.WalkTo.NextAction = actionType; - this.PlayerManager.Action = ActionType.WalkingTo; - } - else - { - this.PlayerManager.Action = actionType; - this.PlayerManager.Position -= 0.15f * Vector3.UnitY; - } - } - else - this.PlayerManager.Action = this.currentApproach == ClimbingApproach.Back ? ActionType.JumpToClimb : ActionType.JumpToSideClimb; - if (this.currentApproach != ClimbingApproach.Left && this.currentApproach != ClimbingApproach.Right) - break; - this.PlayerManager.LookingDirection = ClimbingApproachExtensions.AsDirection(this.currentApproach); - break; - } - } - - protected override void Begin() - { - this.PlayerManager.Position = this.PlayerManager.Position * Vector3.UnitY + (this.PlayerManager.HeldInstance.Position + FezMath.HalfVector) * FezMath.XZMask; - if (FezButtonStateExtensions.IsDown(this.InputManager.Down)) - this.PlayerManager.Position -= 1.0 / 500.0 * Vector3.UnitY; - this.GomezService.OnClimbLadder(); - } - - private TrileInstance IsOnLadder(out ClimbingApproach approach) - { - Vector3 b = FezMath.ForwardVector(this.CameraManager.Viewpoint); - Vector3 vector3 = FezMath.RightVector(this.CameraManager.Viewpoint); - float num1 = float.MaxValue; - bool flag1 = false; - TrileInstance trileInstance1 = (TrileInstance) null; - bool flag2 = true; - if (this.currentApproach == ClimbingApproach.None) - { - NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.Center, this.PlayerManager.Background ? QueryOptions.Background : QueryOptions.None); - flag2 = nearestTriles.Surface != null && nearestTriles.Surface.Trile.ActorSettings.Type == ActorType.Ladder; - } - foreach (NearestTriles nearestTriles in this.PlayerManager.AxisCollision.Values) - { - if (nearestTriles.Surface != null && this.TestLadderCollision(nearestTriles.Surface, true)) - { - TrileInstance trileInstance2 = nearestTriles.Surface; - float num2 = FezMath.Dot(trileInstance2.Position, b); - if (flag2 && (double) num2 < (double) num1) - { - num1 = num2; - trileInstance1 = trileInstance2; - } - } - } - if (trileInstance1 == null) - { - foreach (NearestTriles nearestTriles in this.PlayerManager.AxisCollision.Values) - { - if (nearestTriles.Surface != null && this.TestLadderCollision(nearestTriles.Surface, false)) - { - TrileInstance trileInstance2 = nearestTriles.Surface; - float num2 = FezMath.Dot(trileInstance2.Position, b); - if (flag2 && (double) num2 < (double) num1) - { - flag1 = true; - num1 = num2; - trileInstance1 = trileInstance2; - } - } - } - } - if (trileInstance1 != null) - { - float num2 = FezMath.Dot(FezMath.AsVector(FezMath.OrientationFromPhi(FezMath.WrapAngle(FezMath.ToPhi(trileInstance1.Trile.ActorSettings.Face) + trileInstance1.Phi))), flag1 ? vector3 : b); - approach = !flag1 ? ((double) num2 > 0.0 ? ClimbingApproach.Front : ClimbingApproach.Back) : ((double) num2 > 0.0 ? ClimbingApproach.Left : ClimbingApproach.Right); - } - else - approach = ClimbingApproach.None; - return trileInstance1; - } - - private bool TestLadderCollision(TrileInstance instance, bool onAxis) - { - TrileActorSettings actorSettings = instance.Trile.ActorSettings; - Axis axis = FezMath.AxisFromPhi(FezMath.WrapAngle(FezMath.ToPhi(actorSettings.Face) + instance.Phi)); - if (actorSettings.Type == ActorType.Ladder) - return axis == FezMath.VisibleAxis(this.CameraManager.Viewpoint) == onAxis; - else - return false; - } - - public override void Update(GameTime gameTime) - { - if (this.sinceGrabbed.TotalSeconds < 0.75) - this.sinceGrabbed += gameTime.ElapsedGameTime; - else - this.lastGrabbed = (TrileInstance) null; - if (this.shouldSyncAnimationHalfway && (double) this.CameraManager.ViewTransitionStep >= 0.5) - { - this.shouldSyncAnimationHalfway = false; - this.SyncAnimation(true); - } - base.Update(gameTime); - } - - private Vector3 GetDestination() - { - return this.PlayerManager.Position * Vector3.UnitY + (this.PlayerManager.HeldInstance.Position + FezMath.HalfVector) * FezMath.XZMask; - } - - protected override bool Act(TimeSpan elapsed) - { - ClimbingApproach approach; - TrileInstance trileInstance1 = this.IsOnLadder(out approach); - this.PlayerManager.HeldInstance = trileInstance1; - if (trileInstance1 == null || this.currentApproach == ClimbingApproach.None) - { - this.PlayerManager.Action = ActionType.Idle; - return false; - } - else - { - this.lastGrabbed = trileInstance1; - this.sinceGrabbed = TimeSpan.Zero; - this.currentApproach = approach; - this.RefreshPlayerAction(); - this.RefreshPlayerDirection(); - this.PlayerManager.Position = this.PlayerManager.Position * Vector3.UnitY + (trileInstance1.Position + FezMath.HalfVector) * FezMath.XZMask; - Vector3 vector3_1 = (float) ((double) this.InputManager.Movement.Y * 4.69999980926514 * 0.425000011920929) * (float) elapsed.TotalSeconds * Vector3.UnitY; - Vector3 b = FezMath.ForwardVector(this.CameraManager.Viewpoint) * (this.PlayerManager.Background ? -1f : 1f); - if ((double) this.PlayerManager.Center.Y < (double) this.LevelManager.Size.Y - 1.0 && (double) this.PlayerManager.Center.Y > 1.0) - { - QueryOptions options = this.PlayerManager.Background ? QueryOptions.Background : QueryOptions.None; - NearestTriles nearestTriles1 = this.LevelManager.NearestTrile(this.PlayerManager.Center + Vector3.Down, options); - NearestTriles nearestTriles2 = this.LevelManager.NearestTrile(this.PlayerManager.Center + vector3_1, options); - NearestTriles nearestTriles3 = this.LevelManager.NearestTrile(this.PlayerManager.Center + vector3_1 + FezMath.Sign(vector3_1) * new Vector3(0.0f, 0.5f, 0.0f), options); - bool flag = false; - if ((nearestTriles2.Surface == null || (flag = nearestTriles3.Deep != null && (double) FezMath.Dot(this.PlayerManager.Position, b) > (double) FezMath.Dot(nearestTriles3.Deep.Center, b))) && (nearestTriles1.Deep == null || nearestTriles1.Deep.GetRotatedFace(this.PlayerManager.Background ? this.CameraManager.VisibleOrientation : FezMath.GetOpposite(this.CameraManager.VisibleOrientation)) == CollisionType.None)) - { - vector3_1 = Vector3.Zero; - if (!flag && (this.PlayerManager.LookingDirection == HorizontalDirection.Left && FezButtonStateExtensions.IsDown(this.InputManager.Left) || this.PlayerManager.LookingDirection == HorizontalDirection.Right && FezButtonStateExtensions.IsDown(this.InputManager.Right))) - { - if (nearestTriles2.Deep == null || nearestTriles1.Surface == null) - { - this.PlayerManager.Action = ActionType.ClimbOverLadder; - return false; - } - else if ((double) FezMath.Dot(nearestTriles2.Deep.Center, b) > (double) FezMath.Dot(nearestTriles1.Surface.Center, b)) - { - this.PlayerManager.Action = ActionType.ClimbOverLadder; - return false; - } - } - } - } - float num1 = (float) ((double) FezMath.Saturate(Math.Abs((float) ((double) this.PlayerManager.Animation.Timing.NormalizedStep * 2.0 % 1.0 - 0.5))) * 1.39999997615814 + 0.25); - int frame = this.PlayerManager.Animation.Timing.Frame; - if (this.lastFrame != frame) - { - if (frame == 1 || frame == 4) - SoundEffectExtensions.EmitAt(this.climbSound, this.PlayerManager.Position); - this.lastFrame = frame; - } - this.PlayerManager.Velocity = vector3_1 * num1; - if (trileInstance1.PhysicsState != null) - { - IPlayerManager playerManager = this.PlayerManager; - Vector3 vector3_2 = playerManager.Velocity + trileInstance1.PhysicsState.Velocity; - playerManager.Velocity = vector3_2; - } - int num2 = Math.Sign(vector3_1.Y); - this.PlayerManager.Animation.Timing.Update(elapsed, (float) num2); - this.PlayerManager.GroundedVelocity = new Vector3?(this.PlayerManager.Velocity); - MultipleHits multipleHits = this.CollisionManager.CollideEdge(this.PlayerManager.Center, vector3_1, this.PlayerManager.Size / 2f, Direction2D.Vertical); - if ((double) vector3_1.Y < 0.0 && (multipleHits.NearLow.Collided || multipleHits.FarHigh.Collided)) - { - TrileInstance trileInstance2 = this.LevelManager.NearestTrile(multipleHits.First.Destination.Center).Surface; - if (trileInstance2 != null && trileInstance2.Trile.ActorSettings.Type == ActorType.Ladder && this.currentApproach == ClimbingApproach.Back) - { - IPlayerManager playerManager = this.PlayerManager; - Vector3 vector3_2 = playerManager.Center + vector3_1; - playerManager.Center = vector3_2; - } - else - { - this.lastGrabbed = (TrileInstance) null; - this.PlayerManager.HeldInstance = (TrileInstance) null; - this.PlayerManager.Action = ActionType.Falling; - } - } - return false; - } - } - - private void RefreshPlayerAction() - { - switch (this.currentApproach) - { - case ClimbingApproach.Right: - case ClimbingApproach.Left: - this.PlayerManager.Action = ActionType.SideClimbingLadder; - break; - case ClimbingApproach.Back: - this.PlayerManager.Action = ActionType.BackClimbingLadder; - break; - case ClimbingApproach.Front: - this.PlayerManager.Action = ActionType.FrontClimbingLadder; - break; - } - } - - private void RefreshPlayerDirection() - { - if (this.PlayerManager.Action != ActionType.SideClimbingLadder) - return; - this.PlayerManager.LookingDirection = ClimbingApproachExtensions.AsDirection(this.currentApproach); - } - - protected override bool IsActionAllowed(ActionType type) - { - return ActionTypeExtensions.IsClimbingLadder(this.PlayerManager.Action); - } - } -} diff --git a/FEZ/Components/Actions/ClimbOverLadder.cs b/FEZ/Components/Actions/ClimbOverLadder.cs deleted file mode 100644 index df5453b..0000000 --- a/FEZ/Components/Actions/ClimbOverLadder.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Type: FezGame.Components.Actions.ClimbOverLadder -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine.Structure; -using FezEngine.Tools; -using FezGame.Structure; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using System; - -namespace FezGame.Components.Actions -{ - public class ClimbOverLadder : PlayerAction - { - private Vector3 camOrigin; - private SoundEffect climbOverSound; - private SoundEffect sLedgeLand; - private int lastFrame; - - public ClimbOverLadder(Game game) - : base(game) - { - } - - protected override void LoadContent() - { - base.LoadContent(); - this.climbOverSound = this.CMProvider.Global.Load("Sounds/Gomez/ClimbOverLadder"); - this.sLedgeLand = this.CMProvider.Global.Load("Sounds/Gomez/LedgeLand"); - } - - protected override void Begin() - { - this.PlayerManager.Velocity = Vector3.Zero; - this.PlayerManager.Position += FezMath.RightVector(this.CameraManager.Viewpoint) * (float) FezMath.Sign(this.PlayerManager.LookingDirection) * 1f / 16f; - this.PlayerManager.Position -= Vector3.UnitY * 0.5f / 16f; - this.PlayerManager.Position *= 16f; - this.PlayerManager.Position = FezMath.Round(this.PlayerManager.Position); - this.PlayerManager.Position /= 16f; - this.PlayerManager.Position -= Vector3.UnitY * 0.5f / 16f; - this.camOrigin = this.CameraManager.Center; - SoundEffectExtensions.EmitAt(this.climbOverSound, this.PlayerManager.Position); - this.lastFrame = -1; - } - - protected override bool Act(TimeSpan elapsed) - { - if (this.PlayerManager.HeldInstance.PhysicsState != null) - { - this.PlayerManager.Velocity = this.PlayerManager.HeldInstance.PhysicsState.Velocity; - this.camOrigin += this.PlayerManager.HeldInstance.PhysicsState.Velocity; - } - Vector3 vector3 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float) FezMath.Sign(this.PlayerManager.LookingDirection) * 10f / 16f; - if (this.lastFrame != this.PlayerManager.Animation.Timing.Frame && this.PlayerManager.Animation.Timing.Frame == 5) - SoundEffectExtensions.EmitAt(this.sLedgeLand, this.PlayerManager.Position); - this.lastFrame = this.PlayerManager.Animation.Timing.Frame; - if (!this.CameraManager.StickyCam) - { - Vector3 constrainedCenter = this.CameraManager.ConstrainedCenter; - } - if (this.PlayerManager.Animation.Timing.Ended) - { - this.PlayerManager.HeldInstance = (TrileInstance) null; - this.PlayerManager.Action = ActionType.Idle; - this.PlayerManager.Position += vector3; - Vector3 position = this.PlayerManager.Position; - this.PlayerManager.Position += 0.5f * Vector3.UnitY; - this.PlayerManager.Velocity = Vector3.Down; - this.PhysicsManager.Update((IComplexPhysicsEntity) this.PlayerManager); - if (!this.PlayerManager.Grounded) - { - this.PlayerManager.Velocity = Vector3.Zero; - this.PlayerManager.Position = position; - } - } - return true; - } - - protected override bool IsActionAllowed(ActionType type) - { - return type == ActionType.ClimbOverLadder; - } - } -} diff --git a/FEZ/Components/Actions/ClimbVine.cs b/FEZ/Components/Actions/ClimbVine.cs deleted file mode 100644 index 44bbb65..0000000 --- a/FEZ/Components/Actions/ClimbVine.cs +++ /dev/null @@ -1,369 +0,0 @@ -// Type: FezGame.Components.Actions.ClimbVine -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine; -using FezEngine.Services; -using FezEngine.Structure; -using FezEngine.Structure.Input; -using FezEngine.Tools; -using FezGame.Services; -using FezGame.Structure; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using System; - -namespace FezGame.Components.Actions -{ - public class ClimbVine : PlayerAction - { - private const float ClimbingSpeed = 0.475f; - private const float SideClimbingFactor = 0.75f; - private ClimbingApproach currentApproach; - private bool shouldSyncAnimationHalfway; - private TimeSpan sinceGrabbed; - private TrileInstance lastGrabbed; - private SoundEffect climbSound; - private int lastFrame; - - public ClimbVine(Game game) - : base(game) - { - this.UpdateOrder = 1; - } - - protected override void LoadContent() - { - base.LoadContent(); - this.climbSound = this.CMProvider.Global.Load("Sounds/Gomez/ClimbVine"); - } - - public override void Initialize() - { - this.CameraManager.ViewpointChanged += new Action(this.ChangeApproach); - base.Initialize(); - } - - private void ChangeApproach() - { - if (!this.IsActionAllowed(this.PlayerManager.Action) || !FezMath.IsOrthographic(this.CameraManager.Viewpoint) || (this.CameraManager.Viewpoint == this.CameraManager.LastViewpoint || this.PlayerManager.IsOnRotato)) - return; - int num = (int) (this.currentApproach + FezMath.GetDistance(this.CameraManager.Viewpoint, this.CameraManager.LastViewpoint)); - if (num > 4) - num -= 4; - if (num < 1) - num += 4; - this.currentApproach = (ClimbingApproach) num; - this.RefreshPlayerAction(true); - this.shouldSyncAnimationHalfway = true; - } - - protected override void TestConditions() - { - switch (this.PlayerManager.Action) - { - case ActionType.Teetering: - case ActionType.IdlePlay: - case ActionType.IdleSleep: - case ActionType.IdleLookAround: - case ActionType.GrabCornerLedge: - case ActionType.GrabLedgeBack: - case ActionType.IdleYawn: - case ActionType.Idle: - case ActionType.LookingLeft: - case ActionType.LookingRight: - case ActionType.LookingUp: - case ActionType.LookingDown: - case ActionType.Walking: - case ActionType.Running: - case ActionType.Jumping: - case ActionType.Lifting: - case ActionType.Falling: - case ActionType.Bouncing: - case ActionType.Flying: - case ActionType.Dropping: - case ActionType.Sliding: - case ActionType.Landing: - TrileInstance trileInstance = this.IsOnVine(out this.currentApproach); - if (this.currentApproach == ClimbingApproach.None || (!FezButtonStateExtensions.IsDown(this.InputManager.Up) || ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action)) && (this.PlayerManager.Grounded || this.currentApproach != ClimbingApproach.Left && this.currentApproach != ClimbingApproach.Right || Math.Sign(this.InputManager.Movement.X) != FezMath.Sign(ClimbingApproachExtensions.AsDirection(this.currentApproach))) && (!ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || !FezButtonStateExtensions.IsDown(this.InputManager.Down)) || trileInstance == this.lastGrabbed) - break; - this.PlayerManager.HeldInstance = trileInstance; - switch (this.currentApproach) - { - case ClimbingApproach.Right: - case ClimbingApproach.Left: - this.PlayerManager.NextAction = ActionType.SideClimbingVine; - break; - case ClimbingApproach.Back: - this.PlayerManager.NextAction = ActionType.BackClimbingVine; - break; - case ClimbingApproach.Front: - this.PlayerManager.NextAction = ActionType.FrontClimbingVine; - break; - } - if (ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action)) - { - this.PlayerManager.Action = this.PlayerManager.NextAction; - this.PlayerManager.NextAction = ActionType.None; - break; - } - else - { - this.PlayerManager.Action = this.currentApproach == ClimbingApproach.Back ? ActionType.JumpToClimb : ActionType.JumpToSideClimb; - this.PlayerManager.Velocity = Vector3.Zero; - if (this.currentApproach != ClimbingApproach.Left && this.currentApproach != ClimbingApproach.Right) - break; - this.PlayerManager.LookingDirection = ClimbingApproachExtensions.AsDirection(this.currentApproach); - break; - } - } - } - - private TrileInstance IsOnVine(out ClimbingApproach approach) - { - Vector3 b = FezMath.ForwardVector(this.CameraManager.Viewpoint); - Vector3 vector3 = FezMath.RightVector(this.CameraManager.Viewpoint); - float num1 = float.MaxValue; - bool flag1 = false; - TrileInstance trileInstance1 = (TrileInstance) null; - bool flag2 = true; - if (this.currentApproach == ClimbingApproach.None) - { - NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.Position - 1.0 / 500.0 * Vector3.UnitY); - flag2 = nearestTriles.Surface != null && nearestTriles.Surface.Trile.ActorSettings.Type == ActorType.Vine; - } - foreach (PointCollision pointCollision in this.PlayerManager.CornerCollision) - { - if (pointCollision.Instances.Surface != null && this.TestVineCollision(pointCollision.Instances.Surface, true)) - { - TrileInstance trileInstance2 = pointCollision.Instances.Surface; - float num2 = FezMath.Dot(trileInstance2.Position, b); - if (flag2 && (double) num2 < (double) num1 && this.TestVineCollision(pointCollision.Instances.Surface, true)) - { - num1 = num2; - trileInstance1 = trileInstance2; - } - } - } - foreach (NearestTriles nearestTriles in this.PlayerManager.AxisCollision.Values) - { - if (nearestTriles.Surface != null && this.TestVineCollision(nearestTriles.Surface, false)) - { - TrileInstance trileInstance2 = nearestTriles.Surface; - float num2 = FezMath.Dot(trileInstance2.Position, b); - if (flag2 && (double) num2 < (double) num1) - { - flag1 = true; - num1 = num2; - trileInstance1 = trileInstance2; - } - } - } - if (trileInstance1 != null) - { - float num2 = FezMath.Dot(FezMath.AsVector(FezMath.OrientationFromPhi(FezMath.WrapAngle(FezMath.ToPhi(trileInstance1.Trile.ActorSettings.Face) + trileInstance1.Phi))), flag1 ? vector3 : b); - approach = !flag1 ? ((double) num2 > 0.0 ? ClimbingApproach.Front : ClimbingApproach.Back) : ((double) num2 > 0.0 ? ClimbingApproach.Left : ClimbingApproach.Right); - } - else - approach = ClimbingApproach.None; - return trileInstance1; - } - - private bool TestVineCollision(TrileInstance instance, bool onAxis) - { - TrileActorSettings actorSettings = instance.Trile.ActorSettings; - Axis axis = FezMath.AxisFromPhi(FezMath.WrapAngle(FezMath.ToPhi(actorSettings.Face) + instance.Phi)); - if (actorSettings.Type == ActorType.Vine) - return axis == FezMath.VisibleAxis(this.CameraManager.Viewpoint) == onAxis; - else - return false; - } - - protected override void Begin() - { - if (this.currentApproach == ClimbingApproach.None) - { - ClimbingApproach approach; - this.PlayerManager.HeldInstance = this.IsOnVine(out approach); - this.currentApproach = approach; - } - this.GomezService.OnClimbVine(); - } - - public override void Update(GameTime gameTime) - { - if (this.GameState.Loading || this.GameState.InMap || (this.GameState.Paused || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)) || this.GameState.InMenuCube) - return; - if (this.sinceGrabbed.TotalSeconds < 1.0) - this.sinceGrabbed += gameTime.ElapsedGameTime; - else - this.lastGrabbed = (TrileInstance) null; - if (this.shouldSyncAnimationHalfway && (double) this.CameraManager.ViewTransitionStep >= 0.5) - { - if (this.PlayerManager.Action == ActionType.BackClimbingVine || this.PlayerManager.Action == ActionType.BackClimbingVineSideways) - this.PlayerManager.Background = false; - this.shouldSyncAnimationHalfway = false; - this.SyncAnimation(true); - this.RefreshPlayerDirection(true); - } - base.Update(gameTime); - } - - protected override bool Act(TimeSpan elapsed) - { - ClimbingApproach approach; - TrileInstance trileInstance1 = this.IsOnVine(out approach); - this.PlayerManager.HeldInstance = trileInstance1; - if (trileInstance1 == null || this.currentApproach == ClimbingApproach.None) - { - this.PlayerManager.Action = ActionType.Idle; - return false; - } - else - { - this.lastGrabbed = trileInstance1; - this.sinceGrabbed = TimeSpan.Zero; - if ((this.currentApproach == ClimbingApproach.Back || this.currentApproach == ClimbingApproach.Front) && (approach == ClimbingApproach.Right || approach == ClimbingApproach.Left)) - this.currentApproach = approach; - if (this.PlayerManager.Action == ActionType.SideClimbingVine && (double) Math.Abs(this.InputManager.Movement.X) > 0.5) - { - Vector3 vector3 = (float) Math.Sign(this.InputManager.Movement.X) * FezMath.RightVector(this.CameraManager.Viewpoint); - NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.Position + vector3); - if (nearestTriles.Surface != null && nearestTriles.Surface.Trile.ActorSettings.Type == ActorType.Vine) - { - this.PlayerManager.Position += vector3 * 0.1f; - this.PlayerManager.ForceOverlapsDetermination(); - trileInstance1 = this.IsOnVine(out this.currentApproach); - this.PlayerManager.HeldInstance = trileInstance1; - } - } - if (trileInstance1 == null || this.currentApproach == ClimbingApproach.None) - { - this.PlayerManager.Action = ActionType.Idle; - return false; - } - else - { - this.RefreshPlayerAction(false); - this.RefreshPlayerDirection(false); - Vector3 vector3_1 = trileInstance1.Position + FezMath.HalfVector; - Vector3 vector3_2 = Vector3.Zero; - switch (this.currentApproach) - { - case ClimbingApproach.Right: - case ClimbingApproach.Left: - TrileInstance trileInstance2 = this.LevelManager.ActualInstanceAt(this.PlayerManager.Position); - vector3_2 = trileInstance2 == null || trileInstance2.Trile.ActorSettings.Type != ActorType.Vine ? FezMath.XZMask : FezMath.SideMask(this.CameraManager.Viewpoint); - break; - case ClimbingApproach.Back: - case ClimbingApproach.Front: - vector3_2 = FezMath.DepthMask(this.CameraManager.Viewpoint); - break; - } - this.PlayerManager.Position = this.PlayerManager.Position * (Vector3.One - vector3_2) + vector3_1 * vector3_2; - Vector2 vector2 = this.InputManager.Movement * 4.7f * 0.475f * (float) elapsed.TotalSeconds; - Vector3 vector = Vector3.Zero; - if (this.PlayerManager.Action != ActionType.SideClimbingVine) - vector = Vector3.Transform(Vector3.UnitX * vector2.X * 0.75f, this.CameraManager.Rotation); - Vector3 impulse = vector2.Y * Vector3.UnitY; - QueryOptions options = this.PlayerManager.Background ? QueryOptions.Background : QueryOptions.None; - FaceOrientation face = this.PlayerManager.Background ? this.CameraManager.VisibleOrientation : FezMath.GetOpposite(this.CameraManager.VisibleOrientation); - NearestTriles nearestTriles1 = this.LevelManager.NearestTrile(this.PlayerManager.Center + Vector3.Down * 1.5f + this.PlayerManager.Size / 2f * FezMath.Sign(vector), options); - NearestTriles nearestTriles2 = this.LevelManager.NearestTrile(this.PlayerManager.Center + vector * 2f, options); - if ((nearestTriles2.Surface == null || nearestTriles2.Surface.Trile.ActorSettings.Type != ActorType.Vine) && (nearestTriles1.Deep == null || nearestTriles1.Deep.GetRotatedFace(face) == CollisionType.None)) - vector = Vector3.Zero; - nearestTriles1 = this.LevelManager.NearestTrile(this.PlayerManager.Center + this.PlayerManager.Size / 2f * Vector3.Down, options); - NearestTriles nearestTriles3 = this.LevelManager.NearestTrile(this.PlayerManager.Center + impulse * 2f, options); - if ((nearestTriles3.Surface == null || nearestTriles3.Surface.Trile.ActorSettings.Type != ActorType.Vine) && (nearestTriles1.Deep == null || nearestTriles1.Deep.GetRotatedFace(face) == CollisionType.None)) - { - impulse = Vector3.Zero; - if (FezButtonStateExtensions.IsDown(this.InputManager.Up)) - { - Vector3 vector3_3 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float) FezMath.Sign(this.PlayerManager.LookingDirection); - TrileInstance trileInstance3 = this.LevelManager.NearestTrile(trileInstance1.Center + vector3_3 * 0.5f + vector3_3 * trileInstance1.TransformedSize / 2f).Deep; - if (trileInstance3 != null && !trileInstance3.Trile.Immaterial && (trileInstance3.Enabled && trileInstance3.GetRotatedFace(face) != CollisionType.None)) - { - TrileInstance trileInstance4 = this.LevelManager.ActualInstanceAt(trileInstance3.Position - vector3_3 + new Vector3(0.5f)); - TrileInstance trileInstance5 = this.LevelManager.NearestTrile(trileInstance3.Position - vector3_3 + new Vector3(0.5f)).Deep; - if ((trileInstance5 == null || !trileInstance5.Enabled || trileInstance5.GetRotatedFace(this.CameraManager.VisibleOrientation) == CollisionType.None) && (trileInstance4 == null || !trileInstance4.Enabled || trileInstance4.Trile.Immaterial)) - { - this.PlayerManager.HeldInstance = trileInstance3; - this.PlayerManager.Action = ActionType.GrabCornerLedge; - Vector3 vector3_4 = (-vector3_3 + Vector3.UnitY) * trileInstance3.TransformedSize / 2f; - this.PlayerManager.Position = trileInstance3.Center + vector3_4; - this.PlayerManager.ForceOverlapsDetermination(); - return false; - } - } - } - } - float num1 = (float) ((double) FezMath.Saturate(Math.Abs((float) ((double) this.PlayerManager.Animation.Timing.NormalizedStep * 2.0 % 1.0 - 0.5))) * 1.39999997615814 + 0.25); - float num2 = FezMath.Saturate(Math.Abs((float) (((double) this.PlayerManager.Animation.Timing.NormalizedStep + 0.300000011920929) % 1.0))) + 0.2f; - int frame = this.PlayerManager.Animation.Timing.Frame; - if (this.lastFrame != frame) - { - bool flag = (double) Math.Abs(this.InputManager.Movement.Y) < 0.5; - if (flag && frame == 0 || !flag && (frame == 1 || frame == 4)) - SoundEffectExtensions.EmitAt(this.climbSound, this.PlayerManager.Position, RandomHelper.Between(-0.100000001490116, 0.100000001490116), RandomHelper.Between(0.899999976158142, 1.0)); - this.lastFrame = frame; - } - this.PlayerManager.Velocity = vector * num2 + impulse * num1; - if (trileInstance1.PhysicsState != null) - { - IPlayerManager playerManager = this.PlayerManager; - Vector3 vector3_3 = playerManager.Velocity + trileInstance1.PhysicsState.Velocity; - playerManager.Velocity = vector3_3; - } - float timeFactor = impulse == Vector3.Zero ? 0.0f : Math.Abs(this.InputManager.Movement.Y); - if (this.PlayerManager.Action != ActionType.SideClimbingVine) - timeFactor = vector == Vector3.Zero ? timeFactor : FezMath.Saturate(timeFactor + Math.Abs(this.InputManager.Movement.X)); - this.PlayerManager.Animation.Timing.Update(elapsed, timeFactor); - this.PlayerManager.GroundedVelocity = new Vector3?(this.PlayerManager.Velocity); - MultipleHits multipleHits = this.CollisionManager.CollideEdge(this.PlayerManager.Center, impulse, this.PlayerManager.Size / 2f, Direction2D.Vertical); - if ((double) impulse.Y < 0.0 && (multipleHits.NearLow.Collided || multipleHits.FarHigh.Collided) && multipleHits.First.Destination.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.None) - { - this.lastGrabbed = (TrileInstance) null; - this.PlayerManager.HeldInstance = (TrileInstance) null; - this.PlayerManager.Action = ActionType.Falling; - } - return false; - } - } - } - - private void RefreshPlayerAction(bool force) - { - if (!force && this.InputManager.Movement == Vector2.Zero) - return; - switch (this.currentApproach) - { - case ClimbingApproach.Right: - case ClimbingApproach.Left: - this.PlayerManager.Action = ActionType.SideClimbingVine; - break; - case ClimbingApproach.Back: - this.PlayerManager.Action = (double) this.InputManager.Movement.Y != 0.0 ? ActionType.BackClimbingVine : ActionType.BackClimbingVineSideways; - break; - case ClimbingApproach.Front: - this.PlayerManager.Action = (double) this.InputManager.Movement.Y != 0.0 ? ActionType.FrontClimbingVine : ActionType.FrontClimbingVineSideways; - break; - } - } - - private void RefreshPlayerDirection(bool force) - { - if (!force && this.InputManager.Movement == Vector2.Zero) - return; - if (this.PlayerManager.Action == ActionType.SideClimbingVine) - this.PlayerManager.LookingDirection = ClimbingApproachExtensions.AsDirection(this.currentApproach); - else - this.PlayerManager.LookingDirection = FezMath.DirectionFromMovement(this.InputManager.Movement.X); - } - - protected override bool IsActionAllowed(ActionType type) - { - return ActionTypeExtensions.IsClimbingVine(this.PlayerManager.Action); - } - } -} diff --git a/FEZ/Components/Actions/Crush.cs b/FEZ/Components/Actions/Crush.cs deleted file mode 100644 index e7df442..0000000 --- a/FEZ/Components/Actions/Crush.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Type: FezGame.Components.Actions.Crush -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezGame.Structure; -using Microsoft.Xna.Framework; -using System; - -namespace FezGame.Components.Actions -{ - public class Crush : PlayerAction - { - private const float Duration = 1.75f; - private float AccumlatedTime; - private Vector3 crushPosition; - - public Crush(Game game) - : base(game) - { - } - - protected override void Begin() - { - this.PlayerManager.Velocity = Vector3.Zero; - this.crushPosition = this.PlayerManager.Position; - this.AccumlatedTime = 0.0f; - } - - protected override bool Act(TimeSpan elapsed) - { - this.AccumlatedTime += (float) elapsed.TotalSeconds; - this.PlayerManager.Position = this.crushPosition; - this.PlayerManager.Animation.Timing.Update(elapsed, 2f); - if ((double) this.AccumlatedTime > 1.75 * (this.PlayerManager.Action == ActionType.CrushHorizontal ? 1.20000004768372 : 1.0)) - this.PlayerManager.Respawn(); - return false; - } - - protected override bool IsActionAllowed(ActionType type) - { - if (type != ActionType.CrushVertical) - return type == ActionType.CrushHorizontal; - else - return true; - } - } -} diff --git a/FEZ/Components/Actions/Die.cs b/FEZ/Components/Actions/Die.cs deleted file mode 100644 index db4e883..0000000 --- a/FEZ/Components/Actions/Die.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Type: FezGame.Components.Actions.Die -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezGame.Structure; -using Microsoft.Xna.Framework; -using System; - -namespace FezGame.Components.Actions -{ - public class Die : PlayerAction - { - public Die(Game game) - : base(game) - { - } - - protected override bool Act(TimeSpan elapsed) - { - if (this.PlayerManager.Animation.Timing.Ended) - { - this.CameraManager.Constrained = false; - this.PlayerManager.Respawn(); - } - return true; - } - - protected override bool IsActionAllowed(ActionType type) - { - return type == ActionType.Dying; - } - } -} diff --git a/FEZ/Components/Actions/DropDown.cs b/FEZ/Components/Actions/DropDown.cs deleted file mode 100644 index 8181224..0000000 --- a/FEZ/Components/Actions/DropDown.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Type: FezGame.Components.Actions.DropDown -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine.Services; -using FezEngine.Structure; -using FezEngine.Structure.Input; -using FezEngine.Tools; -using FezGame.Services; -using FezGame.Structure; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; - -namespace FezGame.Components.Actions -{ - public class DropDown : PlayerAction - { - public const float DroppingSpeed = 0.05f; - private SoundEffect dropLedgeSound; - private SoundEffect dropVineSound; - private SoundEffect dropLadderSound; - - public DropDown(Game game) - : base(game) - { - this.UpdateOrder = 2; - } - - protected override void LoadContent() - { - base.LoadContent(); - this.dropLedgeSound = this.CMProvider.Global.Load("Sounds/Gomez/LedgeDrop"); - this.dropVineSound = this.CMProvider.Global.Load("Sounds/Gomez/DropFromVine"); - this.dropLadderSound = this.CMProvider.Global.Load("Sounds/Gomez/DropFromLadder"); - } - - protected override void TestConditions() - { - switch (this.PlayerManager.Action) - { - case ActionType.FrontClimbingLadder: - case ActionType.BackClimbingLadder: - case ActionType.SideClimbingLadder: - case ActionType.FrontClimbingVine: - case ActionType.SideClimbingVine: - case ActionType.BackClimbingVine: - case ActionType.GrabCornerLedge: - case ActionType.GrabLedgeFront: - case ActionType.GrabLedgeBack: - case ActionType.LowerToLedge: - case ActionType.ToCornerFront: - case ActionType.ToCornerBack: - case ActionType.FromCornerBack: - if ((this.InputManager.Jump != FezButtonState.Pressed || !FezButtonStateExtensions.IsDown(this.InputManager.Down)) && (!ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || this.InputManager.Down != FezButtonState.Pressed) || !FezMath.AlmostEqual(this.InputManager.Movement.X, 0.0f)) - break; - this.PlayerManager.HeldInstance = (TrileInstance) null; - this.PlayerManager.Action = ActionType.Dropping; - this.PlayerManager.CanDoubleJump = false; - break; - } - } - - protected override void Begin() - { - base.Begin(); - if (ActionTypeExtensions.IsClimbingLadder(this.PlayerManager.LastAction)) - SoundEffectExtensions.EmitAt(this.dropLadderSound, this.PlayerManager.Position); - else if (ActionTypeExtensions.IsClimbingVine(this.PlayerManager.LastAction)) - SoundEffectExtensions.EmitAt(this.dropVineSound, this.PlayerManager.Position); - else if (ActionTypeExtensions.IsOnLedge(this.PlayerManager.LastAction)) - { - SoundEffectExtensions.EmitAt(this.dropLedgeSound, this.PlayerManager.Position); - this.GomezService.OnDropLedge(); - Vector3 position = this.PlayerManager.Position; - if (this.PlayerManager.LastAction == ActionType.GrabCornerLedge || this.PlayerManager.LastAction == ActionType.LowerToCornerLedge) - this.PlayerManager.Position += FezMath.RightVector(this.CameraManager.Viewpoint) * (float) -FezMath.Sign(this.PlayerManager.LookingDirection) * 0.5f; - this.PhysicsManager.DetermineInBackground((IPhysicsEntity) this.PlayerManager, true, false, false); - this.PlayerManager.Position = position; - } - if (this.PlayerManager.Grounded) - { - this.PlayerManager.Position -= Vector3.UnitY * 0.01f; - IPlayerManager playerManager = this.PlayerManager; - Vector3 vector3 = playerManager.Velocity - 0.0075f * Vector3.UnitY; - playerManager.Velocity = vector3; - } - else - this.PlayerManager.Velocity = Vector3.Zero; - if (this.PlayerManager.LastAction != ActionType.GrabCornerLedge) - return; - this.PlayerManager.Position += FezMath.RightVector(this.CameraManager.Viewpoint) * (float) -FezMath.Sign(this.PlayerManager.LookingDirection) * (15.0 / 32.0); - this.PlayerManager.ForceOverlapsDetermination(); - NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.Position - 1.0 / 500.0 * Vector3.UnitY); - if (nearestTriles.Surface == null || nearestTriles.Surface.Trile.ActorSettings.Type != ActorType.Vine) - return; - this.PlayerManager.Action = ActionType.SideClimbingVine; - } - - protected override bool IsActionAllowed(ActionType type) - { - return type == ActionType.Dropping; - } - } -} diff --git a/FEZ/Components/Actions/DropTrile.cs b/FEZ/Components/Actions/DropTrile.cs deleted file mode 100644 index 575de40..0000000 --- a/FEZ/Components/Actions/DropTrile.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Type: FezGame.Components.Actions.DropTrile -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine; -using FezEngine.Structure; -using FezEngine.Structure.Input; -using FezEngine.Tools; -using FezGame.Services; -using FezGame.Structure; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using System; - -namespace FezGame.Components.Actions -{ - internal class DropTrile : PlayerAction - { - private SoundEffect dropHeavySound; - private SoundEffect dropLightSound; - - public DropTrile(Game game) - : base(game) - { - } - - protected override void LoadContent() - { - base.LoadContent(); - this.dropHeavySound = this.CMProvider.Global.Load("Sounds/Gomez/DropHeavyPickup"); - this.dropLightSound = this.CMProvider.Global.Load("Sounds/Gomez/DropLightPickup"); - } - - protected override void TestConditions() - { - switch (this.PlayerManager.Action) - { - case ActionType.CarryIdle: - case ActionType.CarryWalk: - case ActionType.CarryJump: - case ActionType.CarrySlide: - case ActionType.CarryHeavyIdle: - case ActionType.CarryHeavyWalk: - case ActionType.CarryHeavyJump: - case ActionType.CarryHeavySlide: - if (this.PlayerManager.Background || this.InputManager.GrabThrow != FezButtonState.Pressed || (double) this.InputManager.Movement.Y >= -0.5 && (double) Math.Abs(this.InputManager.Movement.X) >= 0.25) - break; - TrileInstance carriedInstance = this.PlayerManager.CarriedInstance; - this.PlayerManager.Action = ActorTypeExtensions.IsLight(carriedInstance.Trile.ActorSettings.Type) ? ActionType.DropTrile : ActionType.DropHeavyTrile; - Vector3 vector3_1 = FezMath.SideMask(this.CameraManager.Viewpoint); - Vector3 vector3_2 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float) FezMath.Sign(this.PlayerManager.LookingDirection); - Vector3 vector3_3 = this.PlayerManager.Center + this.PlayerManager.Size / 2f * (Vector3.Down + vector3_2) - carriedInstance.TransformedSize / 2f * vector3_2 + carriedInstance.Trile.Size / 2f * (Vector3.UnitY + vector3_2) + 0.125f * vector3_2; - carriedInstance.Enabled = false; - MultipleHits result = this.CollisionManager.CollideEdge(carriedInstance.Center, vector3_3 - carriedInstance.Center, carriedInstance.TransformedSize / 2f, Direction2D.Horizontal); - if (BoxCollisionResultExtensions.AnyCollided(result)) - { - CollisionResult collisionResult = result.NearLow; - if (!collisionResult.Collided || collisionResult.Destination.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.AllSides || (double) Math.Abs(collisionResult.Destination.Center.Y - vector3_3.Y) >= 1.0) - collisionResult = result.FarHigh; - if (collisionResult.Collided && collisionResult.Destination.GetRotatedFace(this.CameraManager.VisibleOrientation) == CollisionType.AllSides && (double) Math.Abs(collisionResult.Destination.Center.Y - vector3_3.Y) < 1.0) - { - TrileInstance trileInstance = collisionResult.Destination; - Vector3 vector3_4 = trileInstance.Center - vector3_2 * trileInstance.TransformedSize / 2f; - Vector3 vector3_5 = vector3_3 + vector3_2 * carriedInstance.TransformedSize / 2f; - this.PlayerManager.Position -= vector3_1 * (vector3_5 - vector3_4); - } - } - carriedInstance.Enabled = true; - IPlayerManager playerManager = this.PlayerManager; - Vector3 vector3_6 = playerManager.Velocity * Vector3.UnitY; - playerManager.Velocity = vector3_6; - break; - } - } - - protected override void Begin() - { - base.Begin(); - if (ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type)) - SoundEffectExtensions.EmitAt(this.dropHeavySound, this.PlayerManager.Position); - else - SoundEffectExtensions.EmitAt(this.dropLightSound, this.PlayerManager.Position); - this.GomezService.OnDropObject(); - } - - protected override bool Act(TimeSpan elapsed) - { - if (this.PlayerManager.CarriedInstance == null) - { - this.PlayerManager.Action = ActionType.Idle; - return false; - } - else - { - Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float) FezMath.Sign(this.PlayerManager.LookingDirection); - TrileInstance carriedInstance = this.PlayerManager.CarriedInstance; - Vector3 vector3_2 = this.PlayerManager.Center + this.PlayerManager.Size / 2f * (Vector3.Down + vector3_1) - carriedInstance.TransformedSize / 2f * vector3_1 + carriedInstance.Trile.Size / 2f * (Vector3.UnitY + vector3_1) + 0.125f * vector3_1; - bool flag = ActorTypeExtensions.IsLight(carriedInstance.Trile.ActorSettings.Type); - Vector2[] vector2Array = flag ? Lift.LightTrilePositioning : Lift.HeavyTrilePositioning; - int index = (flag ? 4 : 7) - this.PlayerManager.Animation.Timing.Frame; - Vector3 vector3_3 = vector3_2 + (vector2Array[index].X * -vector3_1 + vector2Array[index].Y * Vector3.Up) * 1f / 16f; - carriedInstance.PhysicsState.Center = vector3_3; - carriedInstance.PhysicsState.UpdateInstance(); - this.PlayerManager.Position -= vector3_3 - carriedInstance.Center; - this.PlayerManager.CarriedInstance.PhysicsState.UpdateInstance(); - if (this.PlayerManager.Animation.Timing.Ended) - { - Vector3 impulse = (float) (3.15000009536743 * (double) Math.Sign(this.CollisionManager.GravityFactor) * 0.150000005960464) * (float) elapsed.TotalSeconds * Vector3.Down; - if ((double) this.PlayerManager.GroundMovement.Y < 0.0) - impulse += this.PlayerManager.GroundMovement; - MultipleHits result = this.CollisionManager.CollideEdge(carriedInstance.PhysicsState.Center, impulse, carriedInstance.TransformedSize / 2f, Direction2D.Vertical); - if (BoxCollisionResultExtensions.AnyCollided(result)) - { - carriedInstance.PhysicsState.Ground = new MultipleHits() - { - NearLow = result.NearLow.Collided ? result.NearLow.Destination : (TrileInstance) null, - FarHigh = result.FarHigh.Collided ? result.FarHigh.Destination : (TrileInstance) null - }; - if (carriedInstance.PhysicsState.Ground.First.PhysicsState != null) - { - carriedInstance.PhysicsState.GroundMovement = carriedInstance.PhysicsState.Ground.First.PhysicsState.Velocity; - carriedInstance.PhysicsState.Center += carriedInstance.PhysicsState.GroundMovement; - } - } - carriedInstance.PhysicsState.Velocity = impulse; - carriedInstance.PhysicsState.UpdateInstance(); - if (flag) - { - this.PlayerManager.Action = ActionType.Idle; - } - else - { - this.PlayerManager.PushedInstance = this.PlayerManager.CarriedInstance; - this.PlayerManager.Action = ActionType.Grabbing; - } - this.PlayerManager.CarriedInstance = (TrileInstance) null; - this.PhysicsManager.HugWalls((IPhysicsEntity) this.PlayerManager, false, false, true); - } - return true; - } - } - - protected override bool IsActionAllowed(ActionType type) - { - if (type != ActionType.DropTrile) - return type == ActionType.DropHeavyTrile; - else - return true; - } - } -} diff --git a/FEZ/Components/Actions/EnterDoor.cs b/FEZ/Components/Actions/EnterDoor.cs deleted file mode 100644 index b4b46d5..0000000 --- a/FEZ/Components/Actions/EnterDoor.cs +++ /dev/null @@ -1,392 +0,0 @@ -// Type: FezGame.Components.Actions.EnterDoor -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine; -using FezEngine.Components; -using FezEngine.Effects; -using FezEngine.Services.Scripting; -using FezEngine.Structure; -using FezEngine.Structure.Input; -using FezEngine.Tools; -using FezGame.Components; -using FezGame.Services; -using FezGame.Structure; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Graphics; -using System; - -namespace FezGame.Components.Actions -{ - public class EnterDoor : PlayerAction - { - private float step = -1f; - private Mesh fadeOutQuad; - private Mesh trileFadeQuad; - private bool hasFlipped; - private bool hasChangedLevel; - private string newLevel; - private Vector3 spinOrigin; - private Vector3 spinDestination; - private SoundEffect sound; - private bool skipFade; - private TimeSpan transitionTime; - private bool skipPreview; - - protected override bool ViewTransitionIndependent - { - get - { - return true; - } - } - - [ServiceDependency] - public IThreadPool ThreadPool { private get; set; } - - [ServiceDependency] - public IDotManager DotManager { private get; set; } - - [ServiceDependency] - public IGameService GameService { private get; set; } - - [ServiceDependency] - public IVolumeService VolumeService { private get; set; } - - public EnterDoor(Game game) - : base(game) - { - } - - protected override void LoadContent() - { - this.fadeOutQuad = new Mesh() - { - AlwaysOnTop = true, - DepthWrites = false - }; - this.fadeOutQuad.AddFace(Vector3.One * 2f, Vector3.Zero, FaceOrientation.Front, Color.Black, true); - Mesh mesh = this.fadeOutQuad; - DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored(); - vertexColored1.ForcedViewMatrix = new Matrix?(Matrix.Identity); - vertexColored1.ForcedProjectionMatrix = new Matrix?(Matrix.Identity); - DefaultEffect.VertexColored vertexColored2 = vertexColored1; - mesh.Effect = (BaseEffect) vertexColored2; - this.trileFadeQuad = new Mesh() - { - AlwaysOnTop = true, - DepthWrites = false - }; - this.trileFadeQuad.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, Color.Black, true); - this.trileFadeQuad.Effect = (BaseEffect) new DefaultEffect.VertexColored(); - this.sound = this.CMProvider.Global.Load("Sounds/Gomez/EnterDoor"); - this.LevelManager.LevelChanged += (Action) (() => - { - this.skipPreview = true; - this.VolumeService.Exit += new Action(this.RevertSkipPreview); - }); - this.DrawOrder = 901; - } - - private void RevertSkipPreview(int id) - { - if (!this.PlayerManager.CanControl) - return; - this.skipPreview = false; - this.VolumeService.Exit -= new Action(this.RevertSkipPreview); - } - - 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.LookingLeft: - case ActionType.LookingRight: - case ActionType.LookingUp: - case ActionType.LookingDown: - case ActionType.Walking: - case ActionType.Running: - case ActionType.Jumping: - case ActionType.Lifting: - case ActionType.Falling: - case ActionType.Bouncing: - case ActionType.Flying: - case ActionType.Dropping: - case ActionType.Sliding: - case ActionType.Landing: - string key = this.PlayerManager.NextLevel; - if (this.PlayerManager.NextLevel == "CABIN_INTERIOR_A") - key = "CABIN_INTERIOR_B"; - if (this.PlayerManager.DoorVolume.HasValue && this.PlayerManager.Grounded && (!this.PlayerManager.HideFez && this.PlayerManager.CanControl) && (!this.PlayerManager.Background && !this.DotManager.PreventPoI && (this.GameState.SaveData.World.ContainsKey(key) && !this.skipPreview)) && (key != this.LevelManager.Name && this.LevelManager.Name != "CRYPT" && this.LevelManager.Name != "PYRAMID")) - { - if (MemoryContentManager.AssetExists("Other Textures\\map_screens\\" + key.Replace('/', '\\'))) - { - Texture2D texture2D = this.CMProvider.CurrentLevel.Load("Other Textures/map_screens/" + key); - this.DotManager.Behaviour = DotHost.BehaviourType.ThoughtBubble; - this.DotManager.DestinationVignette = texture2D; - this.DotManager.ComeOut(); - if (this.DotManager.Owner != this) - this.DotManager.Hey(); - this.DotManager.Owner = (object) this; - } - else - this.UnDotize(); - } - else - this.UnDotize(); - if ((double) this.step != -1.0 || this.InputManager.ExactUp != FezButtonState.Pressed && this.PlayerManager.LastAction != ActionType.OpeningDoor || !this.PlayerManager.Grounded || (!this.PlayerManager.DoorVolume.HasValue || this.PlayerManager.Background)) - break; - this.UnDotize(); - this.GameState.SkipLoadScreen = this.skipFade = this.LevelManager.DestinationVolumeId.HasValue && this.PlayerManager.NextLevel == this.LevelManager.Name; - bool spinThroughDoor = this.PlayerManager.SpinThroughDoor; - if (spinThroughDoor) - { - Vector3 b = FezMath.ForwardVector(this.CameraManager.Viewpoint); - Vector3 vector3 = FezMath.DepthMask(this.CameraManager.Viewpoint); - Volume volume = this.LevelManager.Volumes[this.PlayerManager.DoorVolume.Value]; - Vector3 a = (volume.From + volume.To) / 2f - (volume.To - volume.From) / 2f * b - b; - if ((double) FezMath.Dot(this.PlayerManager.Position, b) < (double) FezMath.Dot(a, b)) - this.PlayerManager.Position = this.PlayerManager.Position * (Vector3.One - vector3) + a * vector3; - this.spinOrigin = this.GetDestination(); - this.spinDestination = this.GetDestination() + b * 1.5f; - } - if (this.PlayerManager.CarriedInstance != null) - { - bool flag = ActorTypeExtensions.IsLight(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type); - this.PlayerManager.Position = this.GetDestination(); - this.PlayerManager.Action = flag ? (spinThroughDoor ? ActionType.EnterDoorSpinCarry : ActionType.CarryEnter) : (spinThroughDoor ? ActionType.EnterDoorSpinCarryHeavy : ActionType.CarryHeavyEnter); - break; - } - else - { - this.WalkTo.Destination = new Func(this.GetDestination); - this.PlayerManager.Action = ActionType.WalkingTo; - this.WalkTo.NextAction = spinThroughDoor ? ActionType.EnterDoorSpin : ActionType.EnteringDoor; - break; - } - } - } - - private void UnDotize() - { - if (this.DotManager.Owner != this) - return; - this.DotManager.Behaviour = DotHost.BehaviourType.FollowGomez; - this.DotManager.Owner = (object) null; - this.DotManager.DestinationVignette = (Texture2D) null; - this.DotManager.Burrow(); - } - - private Vector3 GetDestination() - { - if (!this.PlayerManager.DoorVolume.HasValue || !this.LevelManager.Volumes.ContainsKey(this.PlayerManager.DoorVolume.Value)) - return this.PlayerManager.Position; - Volume volume = this.LevelManager.Volumes[this.PlayerManager.DoorVolume.Value]; - return this.PlayerManager.Position * (Vector3.UnitY + FezMath.DepthMask(this.CameraManager.Viewpoint)) + (volume.From + volume.To) / 2f * FezMath.SideMask(this.CameraManager.Viewpoint); - } - - 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(); - } - } - - private void StartTransition(Vector3 originalCenter, Vector3 destinationCenter) - { - Waiters.Interpolate(1.75, (Action) (s => this.CameraManager.Center = Vector3.Lerp(originalCenter, destinationCenter, Easing.EaseInOut((double) s, EasingType.Quadratic)))).AutoPause = true; - } - - protected override bool IsActionAllowed(ActionType type) - { - if (!ActionTypeExtensions.IsEnteringDoor(type)) - return (double) this.step != -1.0; - else - return true; - } - - 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 worker = this.ThreadPool.Take(new Action(this.DoLoad)); - worker.Finished += (Action) (() => this.ThreadPool.Return(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; - } - } - - private void DoLoad(bool dummy) - { - this.LevelManager.ChangeLevel(this.newLevel); - this.PlayerManager.ForceOverlapsDetermination(); - TrileInstance instance1 = this.PlayerManager.AxisCollision[VerticalDirection.Up].Surface; - if (instance1 != null && instance1.Trile.ActorSettings.Type == ActorType.UnlockedDoor && FezMath.OrientationFromPhi(FezMath.ToPhi(instance1.Trile.ActorSettings.Face) + instance1.Phi) == FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) - { - ++this.GameState.SaveData.ThisLevel.FilledConditions.UnlockedDoorCount; - TrileEmplacement id = instance1.Emplacement + Vector3.UnitY; - TrileInstance instance2 = this.LevelManager.TrileInstanceAt(ref id); - if (instance2.Trile.ActorSettings.Type == ActorType.UnlockedDoor) - ++this.GameState.SaveData.ThisLevel.FilledConditions.UnlockedDoorCount; - this.LevelManager.ClearTrile(instance1); - this.LevelManager.ClearTrile(instance2); - this.GameState.SaveData.ThisLevel.InactiveTriles.Add(instance1.Emplacement); - instance1.ActorSettings.Inactive = true; - } - if (!this.PlayerManager.SpinThroughDoor) - { - if (this.PlayerManager.CarriedInstance != null) - this.PlayerManager.Action = ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) ? ActionType.ExitDoorCarryHeavy : ActionType.ExitDoorCarry; - else - this.PlayerManager.Action = ActionType.ExitDoor; - } - if (!this.skipFade) - this.GameState.ScheduleLoadEnd = true; - this.GameState.SkipLoadScreen = false; - } - - public override void Draw(GameTime gameTime) - { - if (!this.IsActionAllowed(this.PlayerManager.Action) || this.LevelManager.DestinationIsFarAway || this.skipFade) - return; - float num = (float) Math.Pow((double) FezMath.Saturate(this.step), this.PlayerManager.SpinThroughDoor ? 2.0 : 3.0); - if (this.PlayerManager.CarriedInstance != null && !this.PlayerManager.SpinThroughDoor) - { - this.trileFadeQuad.Rotation = this.CameraManager.Rotation; - this.trileFadeQuad.Position = this.PlayerManager.CarriedInstance.Center; - switch (this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) - { - case ActorType.Bomb: - case ActorType.BigBomb: - this.trileFadeQuad.Scale = new Vector3(0.75f, 1f, 0.75f); - break; - case ActorType.Vase: - this.trileFadeQuad.Scale = new Vector3(0.875f, 1f, 0.875f); - break; - default: - this.trileFadeQuad.Scale = Vector3.One; - break; - } - this.trileFadeQuad.Material.Opacity = this.hasFlipped ? 1f - this.step : num; - GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.NoSilhouette); - this.trileFadeQuad.Draw(); - GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.None)); - } - this.fadeOutQuad.Material.Opacity = this.hasFlipped ? 1f - num : num; - this.fadeOutQuad.Draw(); - } - } -} diff --git a/FEZ/Components/Actions/EnterPipe.cs b/FEZ/Components/Actions/EnterPipe.cs deleted file mode 100644 index 24fff1e..0000000 --- a/FEZ/Components/Actions/EnterPipe.cs +++ /dev/null @@ -1,214 +0,0 @@ -// Type: FezGame.Components.Actions.EnterPipe -// Assembly: FEZ, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -// MVID: 9D78BCDD-808F-47ED-B61F-DABBAB0FB594 -// Assembly location: F:\Program Files (x86)\FEZ\FEZ.exe - -using FezEngine.Services; -using FezEngine.Structure; -using FezEngine.Structure.Input; -using FezEngine.Structure.Scripting; -using FezEngine.Tools; -using FezGame.Services; -using FezGame.Structure; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace FezGame.Components.Actions -{ - internal class EnterPipe : PlayerAction - { - private const float SuckedSeconds = 0.75f; - private const float FadeSeconds = 1.25f; - private SoundEffect EnterSound; - private SoundEffect ExitSound; - private Volume PipeVolume; - private EnterPipe.States State; - private bool Descending; - private TimeSpan SinceChanged; - private string NextLevel; - private float Depth; - - [ServiceDependency] - public ITargetRenderingManager TargetRenderer { private get; set; } - - [ServiceDependency] - public IThreadPool ThreadPool { private get; set; } - - public EnterPipe(Game game) - : base(game) - { - this.DrawOrder = 101; - } - - protected override void LoadContent() - { - base.LoadContent(); - this.EnterSound = this.CMProvider.Global.Load("Sounds/Sewer/PipeDown"); - this.ExitSound = this.CMProvider.Global.Load("Sounds/Sewer/PipeUp"); - } - - protected override void TestConditions() - { - if (this.PlayerManager.Action == ActionType.WalkingTo || this.IsActionAllowed(this.PlayerManager.Action)) - return; - if (this.PlayerManager.Grounded && (this.PlayerManager.PipeVolume.HasValue && this.InputManager.Down == FezButtonState.Pressed)) - { - this.PipeVolume = this.LevelManager.Volumes[this.PlayerManager.PipeVolume.Value]; - this.PlayerManager.Action = ActionType.EnteringPipe; - this.Descending = true; - } - if (this.PlayerManager.Grounded || (!this.PlayerManager.PipeVolume.HasValue || !FezButtonStateExtensions.IsDown(this.InputManager.Up) || !BoxCollisionResultExtensions.AnyCollided(this.PlayerManager.Ceiling))) - return; - this.PipeVolume = this.LevelManager.Volumes[this.PlayerManager.PipeVolume.Value]; - this.PlayerManager.Action = ActionType.EnteringPipe; - this.Descending = false; - Vector3 vector3_1 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); - Vector3 vector3_2 = (this.PipeVolume.From + this.PipeVolume.To) / 2f; - this.PlayerManager.Position = this.PlayerManager.Position * vector3_1 + vector3_2 * (Vector3.One - vector3_1); - } - - protected override void Begin() - { - this.NextLevel = this.PlayerManager.NextLevel; - this.State = EnterPipe.States.Sucked; - this.SinceChanged = TimeSpan.Zero; - this.PlayerManager.Velocity = Vector3.Zero; - SoundEffectExtensions.EmitAt(this.EnterSound, this.PlayerManager.Position); - } - - protected override void End() - { - this.State = EnterPipe.States.None; - } - - protected override bool Act(TimeSpan elapsed) - { - switch (this.State) - { - case EnterPipe.States.Sucked: - this.PlayerManager.Position += (float) elapsed.TotalSeconds * Vector3.UnitY * (this.Descending ? -1f : 1f) * 0.75f; - this.SinceChanged += elapsed; - if (this.SinceChanged.TotalSeconds > 0.75) - { - this.State = EnterPipe.States.FadeOut; - this.SinceChanged = TimeSpan.Zero; - break; - } - else - break; - case EnterPipe.States.FadeOut: - this.PlayerManager.Position += (float) elapsed.TotalSeconds * Vector3.UnitY * (this.Descending ? -1f : 1f) * 0.75f; - this.SinceChanged += elapsed; - if (this.SinceChanged.TotalSeconds > 1.25) - { - this.State = EnterPipe.States.LevelChange; - this.SinceChanged = TimeSpan.Zero; - this.GameState.Loading = true; - Worker worker = this.ThreadPool.Take(new Action(this.DoLoad)); - worker.Finished += (Action) (() => this.ThreadPool.Return(worker)); - worker.Start(false); - break; - } - else - break; - case EnterPipe.States.FadeIn: - if (this.SinceChanged == TimeSpan.Zero) - SoundEffectExtensions.EmitAt(this.ExitSound, this.PlayerManager.Position); - Vector3 vector3_1 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); - this.PlayerManager.Position = this.PlayerManager.Position * vector3_1 + this.Depth * (Vector3.One - vector3_1); - this.PlayerManager.Position += (float) elapsed.TotalSeconds * Vector3.UnitY * (this.Descending ? -1.1f : 1f) * 0.75f; - this.SinceChanged += elapsed; - if (this.SinceChanged.TotalSeconds > 1.25) - { - this.State = EnterPipe.States.SpitOut; - this.SinceChanged = TimeSpan.Zero; - break; - } - else - break; - case EnterPipe.States.SpitOut: - this.PlayerManager.Position += (float) elapsed.TotalSeconds * Vector3.UnitY * (this.Descending ? -1.1f : 1f) * 0.75f; - this.SinceChanged += elapsed; - bool flag = true; - foreach (PointCollision pointCollision in this.PlayerManager.CornerCollision) - flag = flag & pointCollision.Instances.Deep == null; - if (!this.Descending && flag || this.SinceChanged.TotalSeconds > 0.75) - { - this.State = EnterPipe.States.None; - this.SinceChanged = TimeSpan.Zero; - if (!this.Descending) - { - this.PlayerManager.Position += 0.5f * Vector3.UnitY; - IPlayerManager playerManager = this.PlayerManager; - Vector3 vector3_2 = playerManager.Velocity - Vector3.UnitY; - playerManager.Velocity = vector3_2; - this.PhysicsManager.Update((IComplexPhysicsEntity) this.PlayerManager); - } - this.PlayerManager.Action = ActionType.Idle; - break; - } - else - break; - } - return false; - } - - private void DoLoad(bool dummy) - { - this.LevelManager.ChangeLevel(this.NextLevel); - this.GameState.ScheduleLoadEnd = true; - this.State = EnterPipe.States.FadeIn; - Volume volume = Enumerable.FirstOrDefault((IEnumerable) this.LevelManager.Volumes.Values, (Func) (v => - { - int local_0 = v.Id; - int? local_1 = Enumerable.First