private void TryPushHorizontalStack(PickupState state, float elapsedSeconds) { TrileInstance trileInstance1 = state.Instance; TrileGroup trileGroup = state.Group; if (!BoxCollisionResultExtensions.AnyCollided(trileInstance1.PhysicsState.WallCollision)) { return; } Vector3 vector3_1 = -FezMath.Sign(trileInstance1.PhysicsState.WallCollision.First.Response); trileInstance1.PhysicsState.Velocity = Vector3.Zero; TrileInstance instance = trileInstance1; while (instance != null && BoxCollisionResultExtensions.AnyCollided(instance.PhysicsState.WallCollision)) { MultipleHits <CollisionResult> wallCollision = instance.PhysicsState.WallCollision; TrileInstance trileInstance2 = wallCollision.First.Destination; if (trileInstance2.PhysicsState != null && ActorTypeExtensions.IsPickable(trileInstance2.Trile.ActorSettings.Type) && (trileGroup == null || !trileGroup.Triles.Contains(trileInstance2))) { Vector3 vector = -wallCollision.First.Response; if (FezMath.Sign(vector) != vector3_1 || vector == Vector3.Zero) { instance = (TrileInstance)null; } else { instance = trileInstance2; Vector3 velocity = instance.PhysicsState.Velocity; instance.PhysicsState.Velocity = vector; Vector3 center = instance.PhysicsState.Center; if (instance.PhysicsState.Grounded) { instance.PhysicsState.Velocity += (float)(3.15000009536743 * (double)Math.Sign(this.CollisionManager.GravityFactor) * 0.150000005960464) * elapsedSeconds * Vector3.Down; } this.PhysicsManager.Update((ISimplePhysicsEntity)instance.PhysicsState, false, false); if (trileInstance1.PhysicsState.Grounded) { instance.PhysicsState.Velocity = velocity; } instance.PhysicsState.UpdateInstance(); this.LevelManager.UpdateInstance(instance); foreach (PickupState pickupState in this.PickupStates) { if (pickupState.Instance.PhysicsState.Ground.NearLow == instance || pickupState.Instance.PhysicsState.Ground.FarHigh == instance) { Vector3 vector3_2 = (instance.PhysicsState.Center - center) / 0.85f; pickupState.Instance.PhysicsState.Velocity = vector3_2; } } } } else { instance = (TrileInstance)null; } } }
private void DetermineFloatMalus(PickupState pickup) { TrileInstance trileInstance1 = pickup.Instance; int num = 0; Vector3 vector3 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); TrileInstance trileInstance2 = trileInstance1; Vector3 b = trileInstance1.Center * vector3; do { TrileInstance trileInstance3 = this.PlayerManager.Ground.NearLow; TrileInstance trileInstance4 = this.PlayerManager.Ground.FarHigh; TrileInstance heldInstance = this.PlayerManager.HeldInstance; if (trileInstance3 == trileInstance2 || trileInstance3 != null && FezMath.AlmostEqual(trileInstance3.Center * vector3, b) || (trileInstance4 == trileInstance2 || trileInstance4 != null && FezMath.AlmostEqual(trileInstance4.Center * vector3, b)) || (heldInstance == trileInstance2 || heldInstance != null && FezMath.AlmostEqual(heldInstance.Center * vector3, b))) { ++num; } if (trileInstance1.PhysicsState.PushedDownBy != null) { ++num; trileInstance2 = trileInstance2.PhysicsState.PushedDownBy; } else { trileInstance2 = (TrileInstance)null; } }while (trileInstance2 != null); pickup.FloatMalus = MathHelper.Lerp(pickup.FloatMalus, -0.25f * (float)num, 0.1f); if (num == 0 || pickup.Group == null) { return; } foreach (TrileInstance trileInstance3 in pickup.Group.Triles) { trileInstance3.PhysicsState.Puppet = true; } pickup.Instance.PhysicsState.Puppet = false; }
private void DetermineFloatMalus(PickupState pickup) { TrileInstance trileInstance1 = pickup.Instance; int num = 0; Vector3 vector3 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); TrileInstance trileInstance2 = trileInstance1; Vector3 b = trileInstance1.Center * vector3; do { TrileInstance trileInstance3 = this.PlayerManager.Ground.NearLow; TrileInstance trileInstance4 = this.PlayerManager.Ground.FarHigh; TrileInstance heldInstance = this.PlayerManager.HeldInstance; if (trileInstance3 == trileInstance2 || trileInstance3 != null && FezMath.AlmostEqual(trileInstance3.Center * vector3, b) || (trileInstance4 == trileInstance2 || trileInstance4 != null && FezMath.AlmostEqual(trileInstance4.Center * vector3, b)) || (heldInstance == trileInstance2 || heldInstance != null && FezMath.AlmostEqual(heldInstance.Center * vector3, b))) ++num; if (trileInstance1.PhysicsState.PushedDownBy != null) { ++num; trileInstance2 = trileInstance2.PhysicsState.PushedDownBy; } else trileInstance2 = (TrileInstance) null; } while (trileInstance2 != null); pickup.FloatMalus = MathHelper.Lerp(pickup.FloatMalus, -0.25f * (float) num, 0.1f); if (num == 0 || pickup.Group == null) return; foreach (TrileInstance trileInstance3 in pickup.Group.Triles) trileInstance3.PhysicsState.Puppet = true; pickup.Instance.PhysicsState.Puppet = false; }
private void TryPushHorizontalStack(PickupState state, float elapsedSeconds) { TrileInstance trileInstance1 = state.Instance; TrileGroup trileGroup = state.Group; if (!BoxCollisionResultExtensions.AnyCollided(trileInstance1.PhysicsState.WallCollision)) return; Vector3 vector3_1 = -FezMath.Sign(trileInstance1.PhysicsState.WallCollision.First.Response); trileInstance1.PhysicsState.Velocity = Vector3.Zero; TrileInstance instance = trileInstance1; while (instance != null && BoxCollisionResultExtensions.AnyCollided(instance.PhysicsState.WallCollision)) { MultipleHits<CollisionResult> wallCollision = instance.PhysicsState.WallCollision; TrileInstance trileInstance2 = wallCollision.First.Destination; if (trileInstance2.PhysicsState != null && ActorTypeExtensions.IsPickable(trileInstance2.Trile.ActorSettings.Type) && (trileGroup == null || !trileGroup.Triles.Contains(trileInstance2))) { Vector3 vector = -wallCollision.First.Response; if (FezMath.Sign(vector) != vector3_1 || vector == Vector3.Zero) { instance = (TrileInstance) null; } else { instance = trileInstance2; Vector3 velocity = instance.PhysicsState.Velocity; instance.PhysicsState.Velocity = vector; Vector3 center = instance.PhysicsState.Center; if (instance.PhysicsState.Grounded) instance.PhysicsState.Velocity += (float) (3.15000009536743 * (double) Math.Sign(this.CollisionManager.GravityFactor) * 0.150000005960464) * elapsedSeconds * Vector3.Down; this.PhysicsManager.Update((ISimplePhysicsEntity) instance.PhysicsState, false, false); if (trileInstance1.PhysicsState.Grounded) instance.PhysicsState.Velocity = velocity; instance.PhysicsState.UpdateInstance(); this.LevelManager.UpdateInstance(instance); foreach (PickupState pickupState in this.PickupStates) { if (pickupState.Instance.PhysicsState.Ground.NearLow == instance || pickupState.Instance.PhysicsState.Ground.FarHigh == instance) { Vector3 vector3_2 = (instance.PhysicsState.Center - center) / 0.85f; pickupState.Instance.PhysicsState.Velocity = vector3_2; } } } } else instance = (TrileInstance) null; } }
private void TryFloat(PickupState pickup, float elapsedSeconds) { // ISSUE: unable to decompile the method. }
public override void Update(GameTime gameTime) { if (this.CameraManager.Viewpoint == Viewpoint.Perspective || !this.CameraManager.ActionRunning || (this.GameState.Paused || this.GameState.InMap) || (this.GameState.Loading || this.PickupStates == null || this.PickupStates.Count == 0)) { return; } this.sinceLevelChanged += (float)gameTime.ElapsedGameTime.TotalSeconds; this.initLock.WaitOne(); for (int index = this.PickupStates.Count - 1; index >= 0; --index) { if (this.PickupStates[index].Instance.PhysicsState == null) { this.PickupStates.RemoveAt(index); } } foreach (PickupState pickupState in this.PickupStates) { if (pickupState.Instance.PhysicsState.StaticGrounds) { pickupState.Instance.PhysicsState.GroundMovement = Vector3.Zero; } } this.PickupStates.Sort((IComparer <PickupState>)MovingGroundsPickupComparer.Default); this.UpdatePickups((float)gameTime.ElapsedGameTime.TotalSeconds); foreach (TrileGroup trileGroup1 in (IEnumerable <TrileGroup>) this.LevelManager.PickupGroups.Values) { if (trileGroup1.InMidAir) { foreach (TrileInstance trileInstance in trileGroup1.Triles) { if (!trileInstance.PhysicsState.Paused && trileInstance.PhysicsState.Grounded) { trileGroup1.InMidAir = false; if (trileInstance.PhysicsState.Puppet) { trileInstance.PhysicsState.Puppet = false; using (List <TrileInstance> .Enumerator enumerator = trileGroup1.Triles.GetEnumerator()) { while (enumerator.MoveNext()) { TrileInstance current = enumerator.Current; if (current != trileInstance) { current.PhysicsState.Puppet = true; } } break; } } else { break; } } } } else { trileGroup1.InMidAir = true; foreach (TrileInstance trileInstance in trileGroup1.Triles) { TrileGroup trileGroup2 = trileGroup1; int num = trileGroup2.InMidAir & !trileInstance.PhysicsState.Grounded ? 1 : 0; trileGroup2.InMidAir = num != 0; } } } foreach (PickupState pickupState1 in this.PickupStates) { if (pickupState1.Group != null && !pickupState1.Instance.PhysicsState.Puppet) { PickupState pickupState2 = pickupState1; foreach (PickupState pickupState3 in this.PickupStates) { if (pickupState3.Group == pickupState2.Group && pickupState3 != pickupState2) { pickupState3.Instance.PhysicsState.Center += pickupState2.LastMovement - pickupState3.LastMovement; pickupState3.Instance.PhysicsState.Background = pickupState2.Instance.PhysicsState.Background; pickupState3.Instance.PhysicsState.Velocity = pickupState2.Instance.PhysicsState.Velocity; pickupState3.Instance.PhysicsState.UpdateInstance(); this.LevelManager.UpdateInstance(pickupState3.Instance); pickupState3.LastMovement = Vector3.Zero; pickupState3.FloatMalus = pickupState2.FloatMalus; pickupState3.FloatSeed = pickupState2.FloatSeed; } } } if (pickupState1.VisibleOverlapper != null) { PickupState pickupState2 = pickupState1.VisibleOverlapper; InstancePhysicsState physicsState = pickupState1.Instance.PhysicsState; physicsState.Background = pickupState2.Instance.PhysicsState.Background; physicsState.Ground = pickupState2.Instance.PhysicsState.Ground; physicsState.Floating = pickupState2.Instance.PhysicsState.Floating; Array.Copy((Array)physicsState.CornerCollision, (Array)pickupState1.Instance.PhysicsState.CornerCollision, 4); physicsState.GroundMovement = pickupState2.Instance.PhysicsState.GroundMovement; physicsState.Sticky = pickupState2.Instance.PhysicsState.Sticky; physicsState.WallCollision = pickupState2.Instance.PhysicsState.WallCollision; physicsState.PushedDownBy = pickupState2.Instance.PhysicsState.PushedDownBy; pickupState1.LastGroundedCenter = pickupState2.LastGroundedCenter; pickupState1.LastVelocity = pickupState2.LastVelocity; pickupState1.TouchesWater = pickupState2.TouchesWater; } } foreach (PickupState pickupState in this.PickupStates) { if (pickupState.Instance.PhysicsState != null && (pickupState.Instance.PhysicsState.Grounded || this.PlayerManager.CarriedInstance == pickupState.Instance || pickupState.Instance.PhysicsState.Floating)) { pickupState.FlightApex = pickupState.Instance.Center.Y; pickupState.LastGroundedCenter = pickupState.Instance.Center; } } this.initLock.Set(); }