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 Act(TimeSpan elapsed) { this.PlayerManager.AirTime += elapsed; bool flag1 = (double)this.CollisionManager.GravityFactor < 0.0; Vector3 vector3_1 = (float)(3.15000009536743 * (double)this.CollisionManager.GravityFactor * 0.150000005960464) * (float)elapsed.TotalSeconds * -Vector3.UnitY; if (this.PlayerManager.Action == ActionType.Suffering) { vector3_1 /= 2f; } IPlayerManager playerManager1 = this.PlayerManager; Vector3 vector3_2 = playerManager1.Velocity + vector3_1; playerManager1.Velocity = vector3_2; bool flag2 = this.PlayerManager.CarriedInstance != null; if (!this.PlayerManager.Grounded && this.PlayerManager.Action != ActionType.Suffering) { float num1 = this.InputManager.Movement.X; IPlayerManager playerManager2 = this.PlayerManager; Vector3 vector3_3 = playerManager2.Velocity + Vector3.Transform(Vector3.UnitX * num1, this.CameraManager.Rotation) * 0.15f * 4.7f * (float)elapsed.TotalSeconds * 0.15f; playerManager2.Velocity = vector3_3; if ((flag1 ? ((double)this.PlayerManager.Velocity.Y > 0.0 ? 1 : 0) : ((double)this.PlayerManager.Velocity.Y < 0.0 ? 1 : 0)) != 0) { IPlayerManager playerManager3 = this.PlayerManager; int num2 = playerManager3.CanDoubleJump & this.PlayerManager.AirTime < Fall.DoubleJumpTime ? 1 : 0; playerManager3.CanDoubleJump = num2 != 0; } } else { this.PlayerManager.CanDoubleJump = true; this.PlayerManager.AirTime = TimeSpan.Zero; } if (!this.PlayerManager.Grounded && ((flag1 ? ((double)this.PlayerManager.Velocity.Y > 0.0 ? 1 : 0) : ((double)this.PlayerManager.Velocity.Y < 0.0 ? 1 : 0)) != 0 && !flag2 && (!ActionTypeExtensions.PreventsFall(this.PlayerManager.Action) && this.PlayerManager.Action != ActionType.Falling))) { this.PlayerManager.Action = ActionType.Falling; } if (this.PlayerManager.GroundedVelocity.HasValue) { float val1 = 5.093625f * (float)elapsed.TotalSeconds; float val2 = (float)((double)val1 / 1.5 * (0.5 + (double)Math.Abs(this.CollisionManager.GravityFactor) * 1.5) / 2.0); if (this.PlayerManager.CarriedInstance != null && ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type)) { val1 *= 0.7f; val2 *= 0.7f; } Vector3 vector3_3 = new Vector3(Math.Min(val1, Math.Max(Math.Max(Math.Abs(this.PlayerManager.GroundedVelocity.Value.X), val2), Math.Max(Math.Abs(this.PlayerManager.GroundedVelocity.Value.Z), val2)))); this.PlayerManager.Velocity = new Vector3(MathHelper.Clamp(this.PlayerManager.Velocity.X, -vector3_3.X, vector3_3.X), this.PlayerManager.Velocity.Y, MathHelper.Clamp(this.PlayerManager.Velocity.Z, -vector3_3.Z, vector3_3.Z)); } return(this.PlayerManager.Action == ActionType.Falling); }
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 void Begin() { base.Begin(); if (this.PlayerManager.CarriedInstance == null) { this.PlayerManager.Action = ActionType.Idle; } else { if (ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type)) { SoundEffectExtensions.EmitAt(this.throwHeavySound, this.PlayerManager.Position); } else { SoundEffectExtensions.EmitAt(this.throwLightSound, this.PlayerManager.Position); } this.GomezService.OnThrowObject(); } }
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.CarryIdle: case ActionType.CarryWalk: case ActionType.CarrySlide: case ActionType.CarryHeavyIdle: case ActionType.CarryHeavyWalk: case ActionType.CarryHeavySlide: case ActionType.Sliding: if (!this.PlayerManager.TunnelVolume.HasValue || this.InputManager.ExactUp != FezButtonState.Pressed) { break; } if (this.PlayerManager.CarriedInstance == null) { this.WalkTo.Destination = new Func <Vector3>(this.GetDestination); this.PlayerManager.Action = ActionType.WalkingTo; this.WalkTo.NextAction = ActionType.EnteringTunnel; break; } else { Vector3 position = this.PlayerManager.Position; this.PlayerManager.Position = this.GetDestination(); this.PlayerManager.CarriedInstance.Position += this.PlayerManager.Position - position; this.PlayerManager.Action = ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) ? ActionType.EnterTunnelCarryHeavy : ActionType.EnterTunnelCarry; break; } } }
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; }
protected override void Begin() { if (this.PlayerManager.CarriedInstance == null && this.PlayerManager.PushedInstance == null) { this.PlayerManager.Action = ActionType.Idle; } else { Vector3 vector = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection); Vector3 mask = FezMath.GetMask(FezMath.VisibleAxis(this.CameraManager.Viewpoint)); Vector3 vector3_1 = FezMath.Abs(vector); if (this.PlayerManager.PushedInstance != null) { this.PlayerManager.CarriedInstance = this.PlayerManager.PushedInstance; this.PlayerManager.PushedInstance = (TrileInstance)null; } TrileInstance carriedInstance = this.PlayerManager.CarriedInstance; TrileInstance first = this.PlayerManager.Ground.First; Vector3 vector3_2 = carriedInstance.Center * vector3_1 + this.PlayerManager.Position * mask + (first.Center.Y + (float)((double)first.Trile.Size.Y / 2.0 + (double)carriedInstance.Trile.Size.Y / 2.0) * (float)Math.Sign(this.CollisionManager.GravityFactor)) * Vector3.UnitY; this.PlayerManager.CarriedInstance.PhysicsState.Center = vector3_2; this.PlayerManager.CarriedInstance.PhysicsState.UpdateInstance(); this.PlayerManager.Position = this.PlayerManager.Position * (Vector3.One - vector3_1) + vector3_2 * vector3_1 + -carriedInstance.TransformedSize / 2f * vector + -3.0 / 16.0 * vector; if (ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type)) { SoundEffectExtensions.EmitAt(this.liftHeavySound, this.PlayerManager.Position); } else { SoundEffectExtensions.EmitAt(this.liftLightSound, this.PlayerManager.Position); } this.GomezService.OnLiftObject(); IPlayerManager playerManager = this.PlayerManager; Vector3 vector3_3 = playerManager.Velocity * Vector3.UnitY; playerManager.Velocity = vector3_3; } }
public void Update(TimeSpan elapsed) { bool flag1 = false; bool flag2 = false; if (this.PlayerManager.Grounded && (this.Group.Triles.Contains(this.PlayerManager.Ground.NearLow) || this.Group.Triles.Contains(this.PlayerManager.Ground.FarHigh))) { flag1 = true; flag2 = this.PlayerManager.CarriedInstance != null; } foreach (TrileInstance trileInstance1 in this.Group.Triles) { Vector3 transformedSize = trileInstance1.TransformedSize; Vector3 center = trileInstance1.Center; Vector3 vector3 = new Vector3(0.0f, 0.5f, 0.0f); Array.Clear((Array)this.Hits, 0, 5); int index = 0; TrileInstance trileInstance2 = this.LevelManager.ActualInstanceAt(center + transformedSize * new Vector3(0.0f, 0.5f, 0.0f) + vector3); if (trileInstance2 != null && Array.IndexOf <TrileInstance>(this.Hits, trileInstance2) == -1) { this.Hits[index++] = trileInstance2; } TrileInstance trileInstance3 = this.LevelManager.ActualInstanceAt(center + transformedSize * new Vector3(0.5f, 0.5f, 0.0f) + vector3); if (trileInstance3 != null && Array.IndexOf <TrileInstance>(this.Hits, trileInstance3) == -1) { this.Hits[index++] = trileInstance3; } TrileInstance trileInstance4 = this.LevelManager.ActualInstanceAt(center + transformedSize * new Vector3(-0.5f, 0.5f, 0.0f) + vector3); if (trileInstance4 != null && Array.IndexOf <TrileInstance>(this.Hits, trileInstance4) == -1) { this.Hits[index++] = trileInstance4; } TrileInstance trileInstance5 = this.LevelManager.ActualInstanceAt(center + transformedSize * new Vector3(0.0f, 0.5f, 0.5f) + vector3); if (trileInstance5 != null && Array.IndexOf <TrileInstance>(this.Hits, trileInstance5) == -1) { this.Hits[index++] = trileInstance5; } TrileInstance trileInstance6 = this.LevelManager.ActualInstanceAt(center + transformedSize * new Vector3(0.0f, 0.5f, -0.5f) + vector3); if (trileInstance6 != null && Array.IndexOf <TrileInstance>(this.Hits, trileInstance6) == -1) { this.Hits[index] = trileInstance6; } if (index != 0 || this.Hits[0] != null) { foreach (TrileInstance trileInstance7 in this.Hits) { if (trileInstance7 != null && trileInstance7.PhysicsState != null && (trileInstance7.PhysicsState.Ground.NearLow == trileInstance1 || trileInstance7.PhysicsState.Ground.FarHigh == trileInstance1)) { if (ActorTypeExtensions.IsHeavy(trileInstance7.Trile.ActorSettings.Type) || flag1) { flag2 = true; } flag1 = true; } } } } float num1 = 0.0f; PushSwitchesHost.SwitchState.SwitchAction switchAction = this.action; switch (this.action) { case PushSwitchesHost.SwitchState.SwitchAction.Up: num1 = 0.0f; if (flag1) { switchAction = PushSwitchesHost.SwitchState.SwitchAction.HalfPush; break; } else { break; } case PushSwitchesHost.SwitchState.SwitchAction.HalfPush: num1 = (float)((double)this.sinceActionStarted.Ticks / (double)PushSwitchesHost.SwitchState.HalfPushDuration.Ticks * (3.0 / 16.0)); if (!flag1) { SoundEffectExtensions.EmitAt(this.ReleaseSound, Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.Group.Triles).Center); switchAction = PushSwitchesHost.SwitchState.SwitchAction.ComingBack; } if (this.sinceActionStarted.Ticks >= PushSwitchesHost.SwitchState.HalfPushDuration.Ticks) { switchAction = PushSwitchesHost.SwitchState.SwitchAction.HeldAtHalf; SoundEffectExtensions.EmitAt(this.ClickSound, Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.Group.Triles).Center); break; } else { break; } case PushSwitchesHost.SwitchState.SwitchAction.HeldAtHalf: num1 = 3.0 / 16.0; if (!flag1) { SoundEffectExtensions.EmitAt(this.ReleaseSound, Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.Group.Triles).Center); switchAction = PushSwitchesHost.SwitchState.SwitchAction.ComingBack; } if (flag1 && flag2) { switchAction = PushSwitchesHost.SwitchState.SwitchAction.FullPush; break; } else { break; } case PushSwitchesHost.SwitchState.SwitchAction.FullPush: num1 = (float)(3.0 / 16.0 + (double)Easing.EaseIn((double)this.sinceActionStarted.Ticks / (double)PushSwitchesHost.SwitchState.FullPushDuration.Ticks, EasingType.Quadratic) * 0.625); if (!flag1 && this.Permanence == PushSwitchesHost.SwitchState.SwitchPermanence.Volatile) { switchAction = PushSwitchesHost.SwitchState.SwitchAction.ComingBack; } if (this.sinceActionStarted.Ticks >= PushSwitchesHost.SwitchState.FullPushDuration.Ticks) { switchAction = PushSwitchesHost.SwitchState.SwitchAction.HeldDown; this.SwitchService.OnPush(this.Group.Id); SoundEffectExtensions.EmitAt(this.ThudSound, Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.Group.Triles).Center); if (this.Permanence == PushSwitchesHost.SwitchState.SwitchPermanence.Permanent) { this.GameState.SaveData.ThisLevel.InactiveGroups.Add(this.Group.Id); break; } else { break; } } else { break; } case PushSwitchesHost.SwitchState.SwitchAction.HeldDown: num1 = 13.0 / 16.0; if (!flag1 && this.Permanence == PushSwitchesHost.SwitchState.SwitchPermanence.Volatile) { this.SwitchService.OnLift(this.Group.Id); switchAction = PushSwitchesHost.SwitchState.SwitchAction.ComingBack; } if (flag1 && !flag2 && this.Permanence == PushSwitchesHost.SwitchState.SwitchPermanence.Volatile) { this.SwitchService.OnLift(this.Group.Id); switchAction = PushSwitchesHost.SwitchState.SwitchAction.BackToHalf; break; } else { break; } case PushSwitchesHost.SwitchState.SwitchAction.ComingBack: num1 = this.lastStep - (float)this.sinceActionStarted.Ticks / ((float)PushSwitchesHost.SwitchState.ComeBackDuration.Ticks * this.lastStep) * this.lastStep; if ((double)this.sinceActionStarted.Ticks >= (double)PushSwitchesHost.SwitchState.ComeBackDuration.Ticks * (double)this.lastStep) { switchAction = PushSwitchesHost.SwitchState.SwitchAction.Up; break; } else { break; } case PushSwitchesHost.SwitchState.SwitchAction.BackToHalf: num1 = this.lastStep - (float)this.sinceActionStarted.Ticks / ((float)PushSwitchesHost.SwitchState.ComeBackDuration.Ticks * this.lastStep) * this.lastStep; if ((double)this.sinceActionStarted.Ticks >= (double)PushSwitchesHost.SwitchState.ComeBackDuration.Ticks * (double)this.lastStep) { switchAction = PushSwitchesHost.SwitchState.SwitchAction.Up; break; } else { break; } } if (switchAction != this.action) { this.action = switchAction; if (switchAction == PushSwitchesHost.SwitchState.SwitchAction.ComingBack || switchAction == PushSwitchesHost.SwitchState.SwitchAction.BackToHalf) { this.lastStep = num1; } this.sinceActionStarted = TimeSpan.Zero; } this.sinceActionStarted += elapsed; float num2 = this.Group.Triles[0].Position.Y; foreach (TrileInstance trileInstance in this.Group.Triles) { trileInstance.Position = new Vector3(trileInstance.Position.X, this.OriginalHeight - num1, trileInstance.Position.Z); } float y = this.Group.Triles[0].Position.Y - num2; foreach (TrileInstance instance in this.Group.Triles) { instance.PhysicsState.Velocity = new Vector3(0.0f, y, 0.0f); if ((double)y != 0.0) { this.LevelManager.UpdateInstance(instance); } } }
private void UpdatePickups(float elapsedSeconds) { Vector3 vector3 = Vector3.UnitY * this.CameraManager.Radius / this.CameraManager.AspectRatio; foreach (PickupState pickupState in this.PickupStates) { TrileInstance trileInstance = pickupState.Instance; InstancePhysicsState physicsState = trileInstance.PhysicsState; ActorType type = trileInstance.Trile.ActorSettings.Type; if (!physicsState.Paused && (physicsState.ShouldRespawn || trileInstance.Enabled && trileInstance != this.PlayerManager.CarriedInstance && (!physicsState.Static || pickupState.TouchesWater))) { this.TryFloat(pickupState, elapsedSeconds); if (!physicsState.Vanished && (!pickupState.TouchesWater || !ActorTypeExtensions.IsBuoyant(type))) { physicsState.Velocity += (float)(3.15000009536743 * (double)this.CollisionManager.GravityFactor * 0.150000005960464) * elapsedSeconds * Vector3.Down; } bool grounded = trileInstance.PhysicsState.Grounded; Vector3 center = physicsState.Center; this.PhysicsManager.Update((ISimplePhysicsEntity)physicsState, false, pickupState.Group == null && (!physicsState.Floating || !FezMath.AlmostEqual(physicsState.Velocity.X, 0.0f) || !FezMath.AlmostEqual(physicsState.Velocity.Z, 0.0f))); pickupState.LastMovement = physicsState.Center - center; if (physicsState.NoVelocityClamping) { physicsState.NoVelocityClamping = false; physicsState.Velocity = Vector3.Zero; } if (pickupState.AttachedAOs != null) { foreach (ArtObjectInstance artObjectInstance in pickupState.AttachedAOs) { artObjectInstance.Position += pickupState.LastMovement; } } if (((double)pickupState.LastGroundedCenter.Y - (double)trileInstance.Position.Y) * (double)Math.Sign(this.CollisionManager.GravityFactor) > (double)vector3.Y) { physicsState.Vanished = true; } else if (this.LevelManager.Loops) { while ((double)trileInstance.Position.Y < 0.0) { trileInstance.Position += this.LevelManager.Size * Vector3.UnitY; } while ((double)trileInstance.Position.Y > (double)this.LevelManager.Size.Y) { trileInstance.Position -= this.LevelManager.Size * Vector3.UnitY; } } if (physicsState.Floating && physicsState.Grounded && !physicsState.PushedUp) { physicsState.Floating = pickupState.TouchesWater = (double)trileInstance.Position.Y <= (double)this.LevelManager.WaterHeight - 13.0 / 16.0 + (double)pickupState.FloatMalus; } physicsState.ForceNonStatic = false; if (ActorTypeExtensions.IsFragile(type)) { if (!trileInstance.PhysicsState.Grounded) { pickupState.FlightApex = Math.Max(pickupState.FlightApex, trileInstance.Center.Y); } else if (!trileInstance.PhysicsState.Respawned && (double)pickupState.FlightApex - (double)trileInstance.Center.Y > (double)PickupsHost.BreakHeight(type)) { this.PlayBreakSound(type, trileInstance.Position); trileInstance.PhysicsState.Vanished = true; this.ParticleSystemManager.Add(new TrixelParticleSystem(this.Game, new TrixelParticleSystem.Settings() { ExplodingInstance = trileInstance, EnergySource = new Vector3?(trileInstance.Center - Vector3.Normalize(pickupState.LastVelocity) * trileInstance.TransformedSize / 2f), ParticleCount = 30, MinimumSize = 1, MaximumSize = 8, GravityModifier = 1f, Energy = 0.25f, BaseVelocity = pickupState.LastVelocity * 0.5f })); this.LevelMaterializer.CullInstanceOut(trileInstance); if (type == ActorType.Vase) { trileInstance.PhysicsState = (InstancePhysicsState)null; this.LevelManager.ClearTrile(trileInstance); break; } else { trileInstance.Enabled = false; trileInstance.PhysicsState.ShouldRespawn = true; } } } this.TryPushHorizontalStack(pickupState, elapsedSeconds); if (physicsState.Static) { pickupState.LastMovement = pickupState.LastVelocity = physicsState.Velocity = Vector3.Zero; physicsState.Respawned = false; } if (physicsState.Vanished) { physicsState.ShouldRespawn = true; } if (physicsState.ShouldRespawn && this.PlayerManager.Action != ActionType.FreeFalling) { physicsState.Center = pickupState.OriginalCenter + new Vector3(1.0 / 1000.0); physicsState.UpdateInstance(); physicsState.Velocity = Vector3.Zero; physicsState.ShouldRespawn = false; pickupState.LastVelocity = Vector3.Zero; pickupState.TouchesWater = false; physicsState.Floating = false; physicsState.PushedDownBy = (TrileInstance)null; trileInstance.Enabled = false; trileInstance.Hidden = true; physicsState.Ground = new MultipleHits <TrileInstance>() { NearLow = this.LevelManager.ActualInstanceAt(physicsState.Center - trileInstance.Trile.Size.Y * Vector3.UnitY) }; ServiceHelper.AddComponent((IGameComponent) new GlitchyRespawner(ServiceHelper.Game, trileInstance)); } physicsState.UpdateInstance(); this.LevelManager.UpdateInstance(trileInstance); if (!grounded && trileInstance.PhysicsState.Grounded && (double)Math.Abs(pickupState.LastVelocity.Y) > 0.0500000007450581) { float num1 = FezMath.Dot(pickupState.LastVelocity, FezMath.RightVector(this.CameraManager.Viewpoint)); float val1 = FezMath.Saturate(pickupState.LastVelocity.Y / (-0.2f * (float)Math.Sign(this.CollisionManager.GravityFactor))); AnimatedTexture animation; if (ActorTypeExtensions.IsHeavy(trileInstance.Trile.ActorSettings.Type)) { if ((double)val1 > 0.5) { animation = this.largeDust; } else { animation = this.smallDust; val1 *= 2f; } } else { animation = this.smallDust; } float num2 = Math.Max(val1, 0.4f); this.SpawnDust(trileInstance, num2, animation, (double)num1 >= 0.0, (double)num1 <= 0.0); if (animation == this.largeDust && (double)num1 != 0.0) { this.SpawnDust(trileInstance, num2, this.smallDust, (double)num1 <0.0, (double)num1> 0.0); } SoundEffectExtensions.EmitAt(this.thudSound, trileInstance.Position, (float)((double)num2 * -0.600000023841858 + 0.300000011920929), num2); } if (physicsState.Grounded && physicsState.Ground.First.PhysicsState != null) { physicsState.Ground.First.PhysicsState.PushedDownBy = trileInstance; } pickupState.LastVelocity = trileInstance.PhysicsState.Velocity; } } }