Ejemplo n.º 1
0
        private void DrawLightFilter()
        {
            GraphicsDevice graphicsDevice = this.GraphicsDevice;

            if (!FezMath.AlmostEqual(this.lightingPostEffect.DawnContribution, 0.0f))
            {
                this.lightingPostEffect.Pass = LightingPostEffect.Passes.Dawn;
                GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Screen);
                this.TargetRenderingManager.DrawFullscreen((BaseEffect)this.lightingPostEffect);
            }
            if (!FezMath.AlmostEqual(this.lightingPostEffect.DuskContribution, 0.0f))
            {
                this.lightingPostEffect.Pass = LightingPostEffect.Passes.Dusk_Multiply;
                GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Multiply);
                this.TargetRenderingManager.DrawFullscreen((BaseEffect)this.lightingPostEffect);
                this.lightingPostEffect.Pass = LightingPostEffect.Passes.Dusk_Screen;
                GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Screen);
                this.TargetRenderingManager.DrawFullscreen((BaseEffect)this.lightingPostEffect);
            }
            if (FezMath.AlmostEqual(this.lightingPostEffect.NightContribution, 0.0f))
            {
                return;
            }
            this.lightingPostEffect.Pass = LightingPostEffect.Passes.Night;
            GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Multiply);
            this.TargetRenderingManager.DrawFullscreen((BaseEffect)this.lightingPostEffect);
        }
Ejemplo n.º 2
0
 public override void Update(GameTime gameTime)
 {
     if (this.GameState.Loading)
     {
         return;
     }
     if (FezMath.AlmostEqual(this.PlayerManager.Velocity.Y, 0.0f))
     {
         if (this.eFall != null && !this.eFall.Dead)
         {
             this.eFall.FadeOutAndDie(0.1f);
             this.eFall = (SoundEmitter)null;
         }
     }
     else
     {
         if (this.eFall == null || this.eFall.Dead)
         {
             this.eFall = SoundEffectExtensions.EmitAt(this.sFall, this.PlayerManager.Position, true, 0.0f, 0.0f);
         }
         this.eFall.Position     = this.PlayerManager.Position;
         this.eFall.VolumeFactor = Easing.EaseIn((double)FezMath.Saturate((float)(-(double)this.PlayerManager.Velocity.Y / 0.400000005960464)), EasingType.Quadratic);
     }
     base.Update(gameTime);
 }
Ejemplo n.º 3
0
            private void Rotate()
            {
                Vector3 vector3 = this.ArtObject.ActorSettings.RotationCenter;

                if (!this.ArtObject.ActorSettings.OffCenter)
                {
                    vector3 = this.ArtObject.Position;
                }
                Quaternion fromAxisAngle = Quaternion.CreateFromAxisAngle(FezMath.ForwardVector(this.ArtObject.ActorSettings.SpinView), 1.570796f);

                TrileInstance[] trileInstanceArray = this.Triles.ToArray();
                foreach (TrileInstance instance in trileInstanceArray)
                {
                    Vector3 a = Vector3.Transform(instance.Position + FezMath.HalfVector - vector3, fromAxisAngle) + vector3 - FezMath.HalfVector;
                    if (!FezMath.AlmostEqual(a, instance.Position))
                    {
                        this.LevelManager.ClearTrile(instance, true);
                        instance.Position = a;
                    }
                }
                foreach (TrileInstance instance in trileInstanceArray)
                {
                    this.LevelManager.UpdateInstance(instance);
                }
            }
Ejemplo n.º 4
0
            public bool Update(TimeSpan elapsed)
            {
                this.SinceChanged += elapsed;
                switch (this.State)
                {
                case SpinAction.Idle:
                    Vector3 vector = (this.PlayerManager.Position - this.ArtObject.Position - new Vector3(0.0f, 1f, 0.0f)) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);
                    vector.X += vector.Z;
                    Vector3 vector3 = FezMath.Abs(vector);
                    if (FezMath.AlmostEqual(FezMath.Abs(Vector3.Transform(Vector3.UnitZ, this.ArtObject.Rotation)), FezMath.DepthMask(this.CameraManager.Viewpoint)) && ((double)vector3.X < 0.899999976158142 && (double)vector3.Y < 1.0) && (this.PlayerManager.CarriedInstance == null && this.PlayerManager.Grounded) && (this.PlayerManager.Action != ActionType.GrabTombstone && this.InputManager.GrabThrow == FezButtonState.Pressed && this.PlayerManager.Action != ActionType.ReadingSign))
                    {
                        this.SinceChanged = TimeSpan.Zero;
                        return(true);
                    }
                    else
                    {
                        break;
                    }

                case SpinAction.Spinning:
                    double     num           = FezMath.Saturate(this.SinceChanged.TotalSeconds / 0.75);
                    Quaternion fromAxisAngle = Quaternion.CreateFromAxisAngle(Vector3.UnitY, Easing.EaseIn(num < 0.949999999254942 ? num / 0.949999999254942 : 1.0 + Math.Sin((num - 0.949999999254942) / 0.0500000007450581 * 6.28318548202515 * 2.0) * 0.00999999977648258 * (1.0 - num) / 0.0500000007450581, EasingType.Linear) * 1.570796f * (float)this.SpinSign);
                    this.ArtObject.Rotation     = this.OriginalAoRotation * fromAxisAngle;
                    this.PlayerManager.Position = Vector3.Transform(this.OriginalPlayerPosition - this.ArtObject.Position, fromAxisAngle) + this.ArtObject.Position;
                    if (this.SinceChanged.TotalSeconds >= 0.75)
                    {
                        this.LastViewpoint = FezMath.AsViewpoint(FezMath.OrientationFromDirection(FezMath.MaxClampXZ(Vector3.Transform(Vector3.Forward, this.ArtObject.Rotation))));
                        int count = Enumerable.Count <TombstonesHost.TombstoneState>((IEnumerable <TombstonesHost.TombstoneState>) this.Host.TrackedStones, (Func <TombstonesHost.TombstoneState, bool>)(x => x.LastViewpoint == this.LastViewpoint));
                        this.TombstoneService.UpdateAlignCount(count);
                        if (count > 1)
                        {
                            this.TombstoneService.OnMoreThanOneAligned();
                        }
                        this.Host.StopSkullRotations = count == 4;
                        this.PlayerManager.Action    = ActionType.GrabTombstone;
                        this.PlayerManager.Position += 0.5f * Vector3.UnitY;
                        this.PlayerManager.Velocity  = Vector3.Down;
                        this.PhysicsManager.Update((IComplexPhysicsEntity)this.PlayerManager);
                        this.SinceChanged -= TimeSpan.FromSeconds(0.75);
                        this.State         = SpinAction.Grabbed;
                        break;
                    }
                    else
                    {
                        break;
                    }

                case SpinAction.Grabbed:
                    if (this.PlayerManager.Action != ActionType.GrabTombstone)
                    {
                        this.State = SpinAction.Idle;
                        break;
                    }
                    else
                    {
                        break;
                    }
                }
                return(false);
            }
Ejemplo n.º 5
0
 public override void Update(GameTime gameTime)
 {
     if (!this.show || this.changingText || FezMath.AlmostEqual(this.CameraManager.InterpolatedCenter, this.oldCamPos, 1.0 / 16.0))
     {
         return;
     }
     this.OnTextChanged(true);
 }
Ejemplo n.º 6
0
        private void PauseGroupOverlaps(bool force)
        {
            if (!force && this.GameState.Loading || (!FezMath.IsOrthographic(this.CameraManager.Viewpoint) || this.LevelManager.PickupGroups.Count == 0))
            {
                return;
            }
            Vector3 b1      = FezMath.ForwardVector(this.CameraManager.Viewpoint);
            Vector3 b2      = FezMath.SideMask(this.CameraManager.Viewpoint);
            Vector3 vector3 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);

            foreach (TrileGroup trileGroup in Enumerable.Distinct <TrileGroup>((IEnumerable <TrileGroup>) this.LevelManager.PickupGroups.Values))
            {
                float num      = float.MaxValue;
                float?nullable = new float?();
                foreach (TrileInstance trileInstance in trileGroup.Triles)
                {
                    num = Math.Min(num, FezMath.Dot(trileInstance.Center, b1));
                    if (!trileInstance.PhysicsState.Puppet)
                    {
                        nullable = new float?(FezMath.Dot(trileInstance.Center, b2));
                    }
                }
                foreach (PickupState pickupState1 in this.PickupStates)
                {
                    if (pickupState1.Group == trileGroup)
                    {
                        TrileInstance trileInstance = pickupState1.Instance;
                        bool          flag          = !FezMath.AlmostEqual(FezMath.Dot(trileInstance.Center, b1), num);
                        trileInstance.PhysicsState.Paused = flag;
                        if (flag)
                        {
                            trileInstance.PhysicsState.Puppet = true;
                            pickupState1.LastMovement         = Vector3.Zero;
                        }
                        else
                        {
                            pickupState1.VisibleOverlapper = (PickupState)null;
                            foreach (PickupState pickupState2 in this.PickupStates)
                            {
                                if (FezMath.AlmostEqual(pickupState2.Instance.Center * vector3, pickupState1.Instance.Center * vector3))
                                {
                                    pickupState2.VisibleOverlapper = pickupState1;
                                }
                            }
                            if (nullable.HasValue && FezMath.AlmostEqual(FezMath.Dot(trileInstance.Center, b2), nullable.Value))
                            {
                                trileInstance.PhysicsState.Puppet = false;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
 public override void Update(GameTime gameTime)
 {
     if (this.GameState.Loading || this.GameState.Paused || (this.GameState.InMap || this.GameState.InFpsMode))
     {
         return;
     }
     this.InterpolatedRotation = Quaternion.Slerp(this.InterpolatedRotation, this.OriginalRotation * this.CameraManager.Rotation, 0.075f);
     if (this.InterpolatedRotation == this.CameraManager.Rotation)
     {
         if (this.eRumble.Dead || this.eRumble.Cue.State == SoundState.Paused)
         {
             return;
         }
         this.eRumble.Cue.Pause();
     }
     else
     {
         Vector3 axis;
         float   angle;
         OwlHeadHost.ToAxisAngle(ref this.InterpolatedRotation, out axis, out angle);
         float num = this.lastAngle - angle;
         if (this.eRumble.Cue.State == SoundState.Paused)
         {
             this.eRumble.Cue.Resume();
         }
         this.eRumble.VolumeFactor = Math.Min(Easing.EaseOut((double)FezMath.Saturate(Math.Abs(num) * 10f), EasingType.Quadratic), 0.5f) * FezMath.Saturate(this.SinceStarted);
         this.SinceStarted        += (float)gameTime.ElapsedGameTime.TotalSeconds;
         this.lastAngle            = angle;
         if (FezMath.AlmostEqual(this.InterpolatedRotation, this.CameraManager.Rotation) || FezMath.AlmostEqual(-this.InterpolatedRotation, this.CameraManager.Rotation))
         {
             this.InterpolatedRotation = this.CameraManager.Rotation;
         }
         Matrix matrix;
         if (this.IsInverted)
         {
             matrix = Matrix.CreateTranslation(0.25f, 0.0f, -0.75f) * Matrix.CreateFromQuaternion(this.InterpolatedRotation) * Matrix.CreateTranslation(this.OriginalTranslation.X - 0.75f, this.OriginalTranslation.Y, this.OriginalTranslation.Z - 0.25f);
             this.AttachedCandlesAo.Rotation = this.InterpolatedRotation;
         }
         else
         {
             matrix = Matrix.CreateTranslation((float)((this.IsBig ? 8.0 : 4.0) / 16.0), 0.0f, (float)-(this.IsBig ? 24 : 12) / 16f) * Matrix.CreateFromQuaternion(this.InterpolatedRotation) * Matrix.CreateTranslation((float)-(this.IsBig ? 8 : 4) / 16f + this.OriginalTranslation.X, this.OriginalTranslation.Y, (float)((this.IsBig ? 24.0 : 12.0) / 16.0) + this.OriginalTranslation.Z);
         }
         Vector3    scale;
         Quaternion rotation;
         Vector3    translation;
         matrix.Decompose(out scale, out rotation, out translation);
         this.OwlHeadAo.Position = translation;
         this.OwlHeadAo.Rotation = rotation;
     }
 }
Ejemplo n.º 8
0
        private void Interpolate(GameTime gameTime)
        {
            float num = MathHelper.Clamp((float)gameTime.ElapsedGameTime.TotalSeconds * this.InterpolationSpeed, 0.0f, 1f);

            if (DefaultCameraManager.NoInterpolation)
            {
                num = 1f;
            }
            if (this.current.Direction == Vector3.Zero)
            {
                return;
            }
            this.current.Direction      = Vector3.Normalize(this.current.Direction);
            this.interpolated.Center    = Vector3.Lerp(this.interpolated.Center, this.current.Center, num);
            this.interpolated.Radius    = MathHelper.Lerp(this.interpolated.Radius, this.current.Radius, num);
            this.interpolated.Direction = FezMath.Slerp(this.interpolated.Direction, this.current.Direction, num);
            bool flag1 = (double)DefaultCameraManager.TransitionSpeed < 2.0 && (FezMath.AlmostEqual(this.interpolated.Direction, this.current.Direction) && FezMath.AlmostEqual(this.interpolated.Center, this.current.Center));
            bool flag2 = FezMath.AlmostEqual(this.interpolated.Radius, this.current.Radius);

            if (this.ForceInterpolation)
            {
                flag1 = false;
                flag2 = false;
            }
            this.viewNewlyReached = flag1 && !this.InterpolationReached;
            if (this.viewNewlyReached)
            {
                this.interpolated.Direction = this.current.Direction;
                this.interpolated.Center    = this.current.Center;
            }
            this.projNewlyReached = flag2 && !this.projReached;
            if (this.projNewlyReached)
            {
                this.interpolated.Radius = this.current.Radius;
            }
            this.InterpolationReached = flag1 && flag2;
            this.projReached          = flag2;
            if (!flag1 || this.viewNewlyReached || (double)num == 1.0)
            {
                this.RebuildInterpolatedView();
            }
            if (flag2 && !this.projNewlyReached && (double)num != 1.0)
            {
                return;
            }
            this.RebuildInterpolatedProj();
        }
Ejemplo n.º 9
0
        public LongRunningAction SetHour(int hour, bool immediate)
        {
            DateTime dateTime = new DateTime(1985, 12, 23, hour, 0, 0);

            if (immediate)
            {
                this.TimeManager.CurrentTime = dateTime;
                return((LongRunningAction)null);
            }
            else
            {
                long ticks            = this.TimeManager.CurrentTime.Ticks;
                long destinationTicks = dateTime.Ticks;
                while (ticks - destinationTicks > 432000000000L)
                {
                    destinationTicks += 864000000000L;
                }
                while (destinationTicks - ticks > 432000000000L)
                {
                    ticks += 864000000000L;
                }
                int direction = Math.Sign(destinationTicks - ticks);
                destinationTicks -= (long)direction * 36000000000L / 2L;
                return(new LongRunningAction((Func <float, float, bool>)((elapsedSeconds, totalSeconds) =>
                {
                    bool local_0 = direction != Math.Sign(destinationTicks - this.TimeManager.CurrentTime.Ticks);
                    if (local_0)
                    {
                        this.TimeManager.TimeFactor = MathHelper.Lerp(this.TimeManager.TimeFactor, this.TimeManager.DefaultTimeFactor, elapsedSeconds);
                    }
                    else if ((double)totalSeconds < 1.0)
                    {
                        this.TimeManager.TimeFactor = (float)((double)this.TimeManager.DefaultTimeFactor * (double)Easing.EaseIn((double)FezMath.Saturate(totalSeconds), EasingType.Quadratic) * 100.0) * (float)direction;
                    }
                    if (local_0)
                    {
                        return FezMath.AlmostEqual(this.TimeManager.TimeFactor, 360f);
                    }
                    else
                    {
                        return false;
                    }
                }), (Action)(() => this.TimeManager.TimeFactor = this.TimeManager.DefaultTimeFactor)));
            }
        }
Ejemplo n.º 10
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.Walking:
     case ActionType.Running:
     case ActionType.Dropping:
     case ActionType.Sliding:
     case ActionType.Grabbing:
     case ActionType.Pushing:
         if (!FezMath.AlmostEqual(FezMath.XZ(this.PlayerManager.Velocity), Vector2.Zero) || (double)this.InputManager.Movement.X != 0.0 || this.PlayerManager.PushedInstance != null || ((double)this.CollisionManager.GravityFactor < 0.0 ? ((double)this.PlayerManager.Velocity.Y >= 0.0 ? 1 : 0) : ((double)this.PlayerManager.Velocity.Y <= 0.0 ? 1 : 0)) == 0)
         {
             break;
         }
         this.PlayerManager.Action = ActionType.Idle;
         break;
     }
 }
Ejemplo n.º 11
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.IdlePlay:
     case ActionType.IdleSleep:
     case ActionType.IdleLookAround:
     case ActionType.IdleYawn:
     case ActionType.Idle:
     case ActionType.Walking:
     case ActionType.Running:
         if (FezMath.AlmostEqual(FezMath.XZ(this.PlayerManager.Velocity), Vector2.Zero) || !FezMath.AlmostEqual(this.InputManager.Movement, Vector2.Zero))
         {
             break;
         }
         this.PlayerManager.Action = ActionType.Sliding;
         break;
     }
 }
Ejemplo n.º 12
0
 public override void Draw(GameTime gameTime)
 {
     if (this.GameState.Loading)
     {
         return;
     }
     this.GraphicsDevice.Clear(EndCutscene32Host.PurpleBlack);
     if (this.ActiveState != TetraordialOoze.State.Zoom)
     {
         return;
     }
     if ((double)this.NoiseMesh.Material.Opacity > 0.0)
     {
         this.NoiseMesh.Draw();
     }
     if (FezMath.AlmostEqual(this.TetraMesh.FirstGroup.Material.Opacity, 0.0f))
     {
         return;
     }
     this.TetraMesh.Draw();
 }
Ejemplo n.º 13
0
        protected override bool Act(TimeSpan elapsed)
        {
            float timeFactor = this.movementHelper.Running ? 1.25f : 1f;

            this.PlayerManager.Animation.Timing.Update(elapsed, timeFactor);
            this.PlayerManager.LookingDirection = this.originalLookingDirection;
            float num1 = FezMath.Dot(this.Destination() - this.PlayerManager.Position, FezMath.RightVector(this.CameraManager.Viewpoint));
            int   num2 = (double)num1 < 0.0 ? -1 : 1;

            this.PlayerManager.LookingDirection = (double)num1 < 0.0 ? HorizontalDirection.Left : HorizontalDirection.Right;
            if (FezMath.AlmostEqual((double)num1, 0.0, 0.01))
            {
                this.ChangeAction();
            }
            else
            {
                this.movementHelper.Update((float)elapsed.TotalSeconds, (float)num2 * 0.75f);
                this.PlayerManager.Velocity = this.PlayerManager.Velocity * (Vector3.UnitY + FezMath.DepthMask(this.CameraManager.Viewpoint)) + FezMath.RightVector(this.CameraManager.Viewpoint) * Math.Min(Math.Abs(FezMath.Dot(this.PlayerManager.Velocity, FezMath.SideMask(this.CameraManager.Viewpoint))), Math.Abs(num1)) * (float)num2;
            }
            return(false);
        }
Ejemplo n.º 14
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Paused || this.GameState.InMap || (!this.CameraManager.ActionRunning || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)) || (this.GameState.Loading || this.PlayerManager.Action == ActionType.FindingTreasure || this.GameState.FarawaySettings.InTransition))
            {
                return;
            }
            TimeSpan timeSpan = TimeSpan.FromTicks(TimeSpan.FromTicks((DateTime.UtcNow - DateTime.FromFileTimeUtc(this.GameState.SaveData.CreationTime)).Ticks).Ticks % 6048000000000L);

            if (this.RedAo.Enabled)
            {
                float angle = FezMath.CurveAngle(this.lastRedAngle, FezMath.WrapAngle((float)((double)FezMath.Round(timeSpan.TotalSeconds) / 60.0 * 6.28318548202515)), 0.1f);
                this.lastRedAngle   = angle;
                this.RedAo.Rotation = Quaternion.CreateFromAxisAngle(-Vector3.UnitZ, angle) * this.RedOriginalRotation;
                this.RedAo.Position = this.RedOriginalPosition + new Vector3(-(float)Math.Cos((double)angle), (float)Math.Sin((double)angle), 0.0f) * 1.45f;
                this.RedSecret      = this.TestSecretFor((double)angle >= 1.19579637050629 && (double)angle <= 1.69579637050629, this.RedAo, this.RedSecret, this.RedTopMost);
            }
            if (this.BlueAo.Enabled)
            {
                float num = FezMath.WrapAngle((float)(timeSpan.TotalMinutes / 60.0 * 6.28318548202515));
                this.BlueAo.Rotation = Quaternion.CreateFromAxisAngle(-Vector3.UnitX, num) * this.BlueOriginalRotation;
                this.BlueAo.Position = this.BlueOriginalPosition + new Vector3(0.0f, (float)Math.Sin((double)num), (float)Math.Cos((double)num)) * 1.45f;
                this.BlueSecret      = this.TestSecretFor(FezMath.AlmostEqual(num, 1.570796f, 0.125f), this.BlueAo, this.BlueSecret, this.BlueTopMost);
            }
            if (this.GreenAo.Enabled)
            {
                float num = FezMath.WrapAngle((float)(timeSpan.TotalHours / 24.0 * 6.28318548202515));
                this.GreenAo.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, num) * this.GreenOriginalRotation;
                this.GreenAo.Position = this.GreenOriginalPosition + new Vector3((float)Math.Cos((double)num), (float)Math.Sin((double)num), 0.0f) * 1.45f;
                this.GreenSecret      = this.TestSecretFor(FezMath.AlmostEqual(num, 1.570796f, 0.125f), this.GreenAo, this.GreenSecret, this.GreenTopMost);
            }
            if (!this.WhiteAo.Enabled)
            {
                return;
            }
            float num1 = FezMath.WrapAngle((float)(timeSpan.TotalDays / 7.0 * 6.28318548202515));

            this.WhiteAo.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, num1) * this.WhiteOriginalRotation;
            this.WhiteAo.Position = this.WhiteOriginalPosition + new Vector3(0.0f, (float)Math.Sin((double)num1), -(float)Math.Cos((double)num1)) * 1.45f;
            this.WhiteSecret      = this.TestSecretFor(FezMath.AlmostEqual(num1, 1.570796f, 0.125f), this.WhiteAo, this.WhiteSecret, this.WhiteTopMost);
        }
Ejemplo n.º 15
0
        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;
        }
Ejemplo n.º 16
0
            public WaterfallState(BackgroundPlane plane, PlaneParticleSystem ps, WaterfallsHost host)
            {
                WaterfallsHost.WaterfallState waterfallState = this;
                ServiceHelper.InjectServices((object)this);
                this.Host           = host;
                this.Plane          = plane;
                this.ParticleSystem = ps;
                bool flag = plane.ActorType == ActorType.Trickle;

                this.Splash = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, this.LevelManager.WaterType != LiquidType.Sewer ? (this.LevelManager.WaterType != LiquidType.Purple ? this.CMProvider.CurrentLevel.Load <AnimatedTexture>("Background Planes/water/" + (flag ? "water_small_splash" : "water_large_splash")) : this.CMProvider.CurrentLevel.Load <AnimatedTexture>("Background Planes/waterPink/" + (flag ? "water_small_splash" : "water_large_splash"))) : this.CMProvider.CurrentLevel.Load <AnimatedTexture>("Background Planes/sewer/" + (flag ? "sewer_small_splash" : "sewer_large_splash")))
                {
                    Doublesided = true,
                    Crosshatch  = true
                };
                this.LevelManager.AddPlane(this.Splash);
                this.Top = FezMath.Dot(this.Plane.Position + this.Plane.Scale * this.Plane.Size / 2f, Vector3.UnitY);
                this.TerminalPosition = this.Plane.Position - this.Plane.Scale * this.Plane.Size / 2f * Vector3.UnitY + Vector3.Transform(Vector3.UnitZ, plane.Rotation) / 16f;
                foreach (BackgroundPlane backgroundPlane in Enumerable.Where <BackgroundPlane>((IEnumerable <BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func <BackgroundPlane, bool>)(x =>
                {
                    int?local_0 = x.AttachedPlane;
                    int local_1 = plane.Id;
                    if ((local_0.GetValueOrDefault() != local_1 ? 0 : (local_0.HasValue ? 1 : 0)) != 0)
                    {
                        return(FezMath.AlmostEqual(Vector3.Transform(Vector3.UnitZ, plane.Rotation).Y, 0.0f));
                    }
                    else
                    {
                        return(false);
                    }
                })))
                {
                    this.AttachedPlanes.Add(backgroundPlane);
                }
                Vector3 position = this.LevelManager.WaterType == LiquidType.None ? this.Top * Vector3.UnitY + this.Plane.Position * FezMath.XZMask : this.TerminalPosition * FezMath.XZMask + this.LevelManager.WaterHeight * Vector3.UnitY;

                Waiters.Wait((double)RandomHelper.Between(0.0, 1.0), (Action)(() => waterfallState.BubblingEmitter = SoundEffectExtensions.EmitAt(waterfallState.Host.SewageFallSound, position, true, RandomHelper.Centered(0.025), 0.0f)));
            }
Ejemplo n.º 17
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Loading || this.PlayerManager.Hidden || this.GameState.InCutscene)
            {
                return;
            }
            Vector3 position = this.PlayerManager.Position;

            if (!this.PlayerManager.CanControl)
            {
                this.InputManager.SaveState();
                this.InputManager.Reset();
            }
            if (this.CameraManager.Viewpoint != Viewpoint.Perspective && this.CameraManager.ActionRunning && (!this.GameState.InMenuCube && !this.GameState.Paused) && (this.CameraManager.RequestedViewpoint == Viewpoint.None && !this.GameState.InMap && !this.LevelManager.IsInvalidatingScreen))
            {
                if (ActionTypeExtensions.AllowsLookingDirectionChange(this.PlayerManager.Action) && !FezMath.AlmostEqual(this.InputManager.Movement.X, 0.0f))
                {
                    this.oldLookDir = this.PlayerManager.LookingDirection;
                    this.PlayerManager.LookingDirection = FezMath.DirectionFromMovement(this.InputManager.Movement.X);
                }
                Vector3 velocity = this.PlayerManager.Velocity;
                this.PhysicsManager.Update((IComplexPhysicsEntity)this.PlayerManager);
                if (this.PlayerManager.Grounded && this.PlayerManager.Ground.NearLow == null)
                {
                    TrileInstance trileInstance = this.PlayerManager.Ground.FarHigh;
                    Vector3       b             = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
                    float         num           = FezMath.Dot(trileInstance.Center - trileInstance.TransformedSize / 2f * b - this.PlayerManager.Center + this.PlayerManager.Size / 2f * b, b);
                    if ((double)num > -0.25)
                    {
                        this.PlayerManager.Position -= Vector3.UnitY * 0.01f * (float)Math.Sign(this.CollisionManager.GravityFactor);
                        if (trileInstance.GetRotatedFace(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) == CollisionType.AllSides)
                        {
                            this.PlayerManager.Position += num * b;
                            this.PlayerManager.Velocity  = velocity * Vector3.UnitY;
                        }
                        else
                        {
                            this.PlayerManager.Velocity = velocity;
                        }
                        this.PlayerManager.Ground = new MultipleHits <TrileInstance>();
                    }
                }
                this.PlayerManager.RecordRespawnInformation();
                if (!ActionTypeExtensions.HandlesZClamping(this.PlayerManager.Action) && (this.oldLookDir != this.PlayerManager.LookingDirection || this.PlayerManager.LastAction == ActionType.RunTurnAround) && (this.PlayerManager.Action != ActionType.Dropping && this.PlayerManager.Action != ActionType.GrabCornerLedge && (this.PlayerManager.Action != ActionType.SuckedIn && this.PlayerManager.Action != ActionType.CrushVertical)) && this.PlayerManager.Action != ActionType.CrushHorizontal)
                {
                    this.CorrectWallOverlap(false);
                }
            }
            if (this.PlayerManager.CarriedInstance != null && this.PlayerManager.Action != ActionType.Suffering)
            {
                this.PlayerManager.CarriedInstance.Position += this.PlayerManager.Position - position;
                this.LevelManager.UpdateInstance(this.PlayerManager.CarriedInstance);
            }
            if (this.PlayerManager.Grounded)
            {
                this.PlayerManager.IgnoreFreefall = false;
            }
            if (this.PlayerManager.Animation != null && this.lastFrame != this.PlayerManager.Animation.Timing.Frame)
            {
                if (this.PlayerManager.Grounded)
                {
                    SurfaceType surfaceType = this.PlayerManager.Ground.First.Trile.SurfaceType;
                    if (this.PlayerManager.Action == ActionType.Landing && this.PlayerManager.Animation.Timing.Frame == 0)
                    {
                        this.PlaySurfaceHit(surfaceType, false);
                    }
                    else if ((this.PlayerManager.Action == ActionType.PullUpBack || this.PlayerManager.Action == ActionType.PullUpFront || this.PlayerManager.Action == ActionType.PullUpCornerLedge) && this.PlayerManager.Animation.Timing.Frame == 5)
                    {
                        this.PlaySurfaceHit(surfaceType, false);
                    }
                    else if (ActionTypeExtensions.GetAnimationPath(this.PlayerManager.Action) == "Walk")
                    {
                        if (this.PlayerManager.Animation.Timing.Frame == 1 || this.PlayerManager.Animation.Timing.Frame == 4)
                        {
                            if (this.PlayerManager.Action != ActionType.Sliding)
                            {
                                SoundEffectExtensions.EmitAt(this.isLeft ? this.LeftStep : this.RightStep, this.PlayerManager.Position, RandomHelper.Between(-0.100000001490116, 0.100000001490116), RandomHelper.Between(0.899999976158142, 1.0));
                                this.isLeft = !this.isLeft;
                            }
                            this.PlaySurfaceHit(surfaceType, false);
                        }
                    }
                    else if (this.PlayerManager.Action == ActionType.Running)
                    {
                        if (this.PlayerManager.Animation.Timing.Frame == 0 || this.PlayerManager.Animation.Timing.Frame == 3)
                        {
                            this.PlaySurfaceHit(surfaceType, true);
                        }
                    }
                    else if (this.PlayerManager.CarriedInstance != null)
                    {
                        if (ActionTypeExtensions.GetAnimationPath(this.PlayerManager.Action) == "CarryHeavyWalk")
                        {
                            if (this.PlayerManager.Animation.Timing.Frame == 0 || this.PlayerManager.Animation.Timing.Frame == 4)
                            {
                                this.PlaySurfaceHit(surfaceType, true);
                            }
                        }
                        else if (ActionTypeExtensions.GetAnimationPath(this.PlayerManager.Action) == "CarryWalk" && (this.PlayerManager.Animation.Timing.Frame == 3 || this.PlayerManager.Animation.Timing.Frame == 7))
                        {
                            this.PlaySurfaceHit(surfaceType, true);
                        }
                    }
                    else
                    {
                        this.isLeft = false;
                    }
                }
                else
                {
                    this.isLeft = false;
                }
                this.lastFrame = this.PlayerManager.Animation.Timing.Frame;
            }
            if (this.PlayerManager.CanControl)
            {
                return;
            }
            this.InputManager.RecoverState();
        }
Ejemplo n.º 18
0
 protected override bool Act(TimeSpan elapsed)
 {
     if (this.PlayerManager.PushedInstance == null || this.PlayerManager.PushedInstance.Hidden || this.PlayerManager.PushedInstance.PhysicsState == null)
     {
         this.PlayerManager.Action         = ActionType.Idle;
         this.PlayerManager.PushedInstance = (TrileInstance)null;
         return(false);
     }
     else
     {
         Vector3              b              = FezMath.SideMask(this.CameraManager.Viewpoint);
         Vector3              vector3        = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
         TrileInstance        pushedInstance = this.PlayerManager.PushedInstance;
         InstancePhysicsState physicsState   = pushedInstance.PhysicsState;
         this.eCratePush.Position = pushedInstance.Center;
         this.eGomezPush.Position = this.PlayerManager.Center;
         if (!physicsState.Grounded)
         {
             this.PlayerManager.PushedInstance = (TrileInstance)null;
             this.PlayerManager.Action         = ActionType.Idle;
             return(false);
         }
         else
         {
             int stackSize = this.FindStackSize(pushedInstance, 0);
             if (stackSize <= 2)
             {
                 this.movementHelper.Entity = (IPhysicsEntity)physicsState;
                 float num = this.InputManager.Movement.X;
                 if (BoxCollisionResultExtensions.AnyCollided(physicsState.WallCollision) && ActorTypeExtensions.IsPickable(physicsState.WallCollision.First.Destination.Trile.ActorSettings.Type))
                 {
                     num *= 5f;
                 }
                 if (pushedInstance.Trile.ActorSettings.Type == ActorType.Couch)
                 {
                     num *= 2f;
                 }
                 this.movementHelper.Update((float)elapsed.TotalSeconds, num / (float)(stackSize + 1));
                 if (this.pickupGroup != null)
                 {
                     pushedInstance.PhysicsState.Puppet = false;
                     foreach (TrileInstance trileInstance in this.pickupGroup.Triles)
                     {
                         if (trileInstance != pushedInstance)
                         {
                             trileInstance.PhysicsState.Velocity = pushedInstance.PhysicsState.Velocity;
                             trileInstance.PhysicsState.Puppet   = true;
                         }
                     }
                 }
                 this.PlayerManager.Center    = Vector3.Up * this.PlayerManager.Center + (FezMath.DepthMask(this.CameraManager.Viewpoint) + b) * physicsState.Center + -vector3 * (pushedInstance.TransformedSize / 2f + this.PlayerManager.Size / 2f);
                 this.eCratePush.VolumeFactor = FezMath.Saturate(Math.Abs(FezMath.Dot(physicsState.Velocity, b)) / 0.024f);
                 if (FezMath.AlmostEqual(FezMath.Dot(physicsState.Velocity, b), 0.0f))
                 {
                     this.PlayerManager.Action = ActionType.Grabbing;
                     return(false);
                 }
             }
             else
             {
                 this.PlayerManager.Action = ActionType.Grabbing;
                 this.eCratePush.Cue.Pause();
                 this.eGomezPush.Cue.Pause();
             }
             return(this.PlayerManager.Action == ActionType.Pushing);
         }
     }
 }
Ejemplo n.º 19
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.Idle:
     case ActionType.LookingLeft:
     case ActionType.LookingRight:
     case ActionType.LookingUp:
     case ActionType.LookingDown:
     case ActionType.Walking:
     case ActionType.Running:
     case ActionType.Sliding:
     case ActionType.Landing:
         if (this.PlayerManager.Background || (this.InputManager.Jump != FezButtonState.Pressed || !FezButtonStateExtensions.IsDown(this.InputManager.Down)) && (!ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || this.InputManager.Down != FezButtonState.Pressed) || !this.PlayerManager.Grounded || (this.PlayerManager.Ground.First.GetRotatedFace(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) != CollisionType.TopOnly || !FezMath.AlmostEqual(this.InputManager.Movement.X, 0.0f)))
         {
             break;
         }
         TrileInstance trileInstance1 = this.PlayerManager.Ground.NearLow ?? this.PlayerManager.Ground.FarHigh;
         if (BoxCollisionResultExtensions.AnyHit(this.CollisionManager.CollideEdge(trileInstance1.Center + trileInstance1.TransformedSize * Vector3.UnitY * 0.498f, Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor), this.PlayerManager.Size * FezMath.XZMask / 2f, Direction2D.Vertical)))
         {
             this.PlayerManager.Position -= Vector3.UnitY * 0.01f * (float)Math.Sign(this.CollisionManager.GravityFactor);
             IPlayerManager playerManager = this.PlayerManager;
             Vector3        vector3       = playerManager.Velocity - 0.0075f * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor);
             playerManager.Velocity = vector3;
             break;
         }
         else
         {
             if (this.PlayerManager.Grounded)
             {
                 TrileInstance trileInstance2 = this.LevelManager.NearestTrile(this.PlayerManager.Ground.First.Center, QueryOptions.None).Surface;
                 if (trileInstance2 != null && trileInstance2.Trile.ActorSettings.Type == ActorType.Ladder)
                 {
                     break;
                 }
             }
             this.PlayerManager.HeldInstance = this.PlayerManager.Ground.NearLow;
             Vector3        vector3_1     = FezMath.SideMask(this.CameraManager.Viewpoint);
             IPlayerManager playerManager = this.PlayerManager;
             Vector3        vector3_2     = playerManager.Velocity * vector3_1 * 0.5f;
             playerManager.Velocity    = vector3_2;
             this.PlayerManager.Action = ActionType.LowerToLedge;
             Waiters.Wait(0.3, (Action)(() =>
             {
                 if (this.PlayerManager.Action != ActionType.LowerToLedge)
                 {
                     return;
                 }
                 SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position);
                 this.PlayerManager.Velocity = Vector3.Zero;
             }));
             this.camOrigin = this.CameraManager.Center;
             break;
         }
     }
 }
Ejemplo n.º 20
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Paused || this.GameState.InMap || (!this.CameraManager.ActionRunning || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)) || this.GameState.Loading)
            {
                return;
            }
            Vector3 depthMask = FezMath.DepthMask(this.CameraManager.Viewpoint);
            Vector3 vector3_1 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);

            if (this.RightPositions == 4)
            {
                this.SinceSolved += (float)gameTime.ElapsedGameTime.TotalSeconds;
                float num    = FezMath.Saturate(this.SinceSolved);
                float amount = Easing.EaseIn((double)num, EasingType.Cubic);
                foreach (TrileInstance instance in this.Blocks)
                {
                    Vector3 v = instance.Center - TetrisPuzzleHost.PuzzleCenter;
                    if ((double)v.Length() > 0.5)
                    {
                        Vector3 vector3_2 = FezMath.Sign(FezMath.AlmostClamp(v, 0.1f));
                        Vector3 vector3_3 = (TetrisPuzzleHost.PuzzleCenter + vector3_2 * 1.75f) * FezMath.XZMask + Vector3.UnitY * instance.Center;
                        Vector3 vector3_4 = (TetrisPuzzleHost.PuzzleCenter + vector3_2) * FezMath.XZMask + Vector3.UnitY * instance.Center;
                        instance.PhysicsState.Center = Vector3.Lerp(vector3_3, vector3_4, amount);
                        instance.PhysicsState.UpdateInstance();
                        this.LevelManager.UpdateInstance(instance);
                    }
                }
                if ((double)num != 1.0)
                {
                    return;
                }
                bool flag = false;
                foreach (TrileInstance instance in this.Blocks)
                {
                    if (!flag)
                    {
                        ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, instance, TetrisPuzzleHost.PuzzleCenter + Vector3.UnitY));
                        flag = true;
                    }
                    else
                    {
                        ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, instance));
                    }
                }
                this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(0);
                foreach (Volume volume in Enumerable.Where <Volume>((IEnumerable <Volume>) this.LevelManager.Volumes.Values, (Func <Volume, bool>)(x =>
                {
                    if (x.ActorSettings != null && x.ActorSettings.IsPointOfInterest)
                    {
                        return(x.Enabled);
                    }
                    else
                    {
                        return(false);
                    }
                })))
                {
                    volume.Enabled = false;
                    this.GameState.SaveData.ThisLevel.InactiveVolumes.Add(volume.Id);
                }
                this.LevelService.ResolvePuzzle();
                this.Enabled = false;
            }
            else
            {
                this.RightPositions = 0;
                int num1 = 0;
                int num2 = 0;
                this.Blocks.Sort((Comparison <TrileInstance>)((a, b) => b.LastTreasureSin.CompareTo(a.LastTreasureSin)));
                using (List <TrileInstance> .Enumerator enumerator = this.Blocks.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        TrileInstance instance = enumerator.Current;
                        if (!instance.PhysicsState.Grounded)
                        {
                            instance.LastTreasureSin = this.SinceStarted;
                        }
                        if ((double)instance.Position.Y >= 19.0 && (double)instance.Position.Y <= 20.5 && (this.PlayerManager.HeldInstance != instance && this.PlayerManager.PushedInstance != instance) && instance.PhysicsState.Grounded && instance.PhysicsState.Ground.First != this.PlayerManager.PushedInstance)
                        {
                            Vector3 vector3_2 = Vector3.Min(Vector3.Max(FezMath.Round((instance.Center - TetrisPuzzleHost.PuzzleCenter) / 1.75f), new Vector3(-3f, 0.0f, -3f)), new Vector3(3f, 1f, 3f));
                            Vector3 vector3_3 = (TetrisPuzzleHost.PuzzleCenter + vector3_2 * 1.75f - instance.Center) * FezMath.XZMask;
                            float   num3      = Math.Max(vector3_3.Length(), 0.1f);
                            instance.PhysicsState.Velocity += 0.25f * vector3_3 / num3 * (float)gameTime.ElapsedGameTime.TotalSeconds;
                            if ((double)num3 <= 0.100000001490116 && (double)vector3_2.Y == 0.0 && instance != this.PlayerManager.Ground.First && !Enumerable.Any <TrileInstance>((IEnumerable <TrileInstance>) this.Blocks, (Func <TrileInstance, bool>)(x => x.PhysicsState.Ground.First == instance)) && Enumerable.Any <TrileInstance>((IEnumerable <TrileInstance>) this.Blocks, (Func <TrileInstance, bool>)(b =>
                            {
                                if (b != instance && FezMath.AlmostEqual(b.Position.Y, instance.Position.Y))
                                {
                                    return((double)Math.Abs(FezMath.Dot(b.Center - instance.Center, depthMask)) < 1.75);
                                }
                                else
                                {
                                    return(false);
                                }
                            })))
                            {
                                int num4 = Math.Sign(FezMath.Dot(instance.Center - TetrisPuzzleHost.PuzzleCenter, depthMask));
                                if (num4 == 0)
                                {
                                    num4 = 1;
                                }
                                for (int index = -2; index <= 2; ++index)
                                {
                                    int     num5             = TetrisPuzzleHost.SpiralTraversal[index + 2] * num4;
                                    Vector3 tetativePosition = vector3_1 * instance.PhysicsState.Center + TetrisPuzzleHost.PuzzleCenter * depthMask + depthMask * (float)num5 * 1.75f;
                                    if (Enumerable.All <TrileInstance>((IEnumerable <TrileInstance>) this.Blocks, (Func <TrileInstance, bool>)(b =>
                                    {
                                        if (b != instance && FezMath.AlmostEqual(b.Position.Y, instance.Position.Y))
                                        {
                                            return((double)Math.Abs(FezMath.Dot(b.Center - tetativePosition, depthMask)) >= 1.57499992847443);
                                        }
                                        else
                                        {
                                            return(true);
                                        }
                                    })))
                                    {
                                        instance.PhysicsState.Center = tetativePosition;
                                        break;
                                    }
                                }
                            }
                            if (this.RightPositions < 4 && (double)num3 <= 0.100000001490116 && instance.PhysicsState.Grounded)
                            {
                                if ((double)instance.Position.Y == 20.0)
                                {
                                    if ((double)vector3_2.X == (double)TetrisPuzzleHost.TwoHigh.X && (double)vector3_2.Z == (double)TetrisPuzzleHost.TwoHigh.Z)
                                    {
                                        this.RightPositions += 2;
                                    }
                                }
                                else
                                {
                                    if ((double)vector3_2.X == (double)TetrisPuzzleHost.Interchangeable1_1.X && (double)vector3_2.Z == (double)TetrisPuzzleHost.Interchangeable1_1.Z || (double)vector3_2.X == (double)TetrisPuzzleHost.Interchangeable1_2.X && (double)vector3_2.Z == (double)TetrisPuzzleHost.Interchangeable1_2.Z)
                                    {
                                        ++num1;
                                    }
                                    if ((double)vector3_2.X == (double)TetrisPuzzleHost.Interchangeable2_1.X && (double)vector3_2.Z == (double)TetrisPuzzleHost.Interchangeable2_1.Z || (double)vector3_2.X == (double)TetrisPuzzleHost.Interchangeable2_2.X && (double)vector3_2.Z == (double)TetrisPuzzleHost.Interchangeable2_2.Z)
                                    {
                                        ++num2;
                                    }
                                }
                            }
                        }
                    }
                }
                if (this.RightPositions >= 4 || num1 != 2 && num2 != 2)
                {
                    return;
                }
                this.RightPositions += 2;
            }
        }
Ejemplo n.º 21
0
 public override void Draw(GameTime gameTime)
 {
     if (this.GameState.Loading)
     {
         return;
     }
     if ((double)this.SinceStarted > 19.0 && this.Rings != null)
     {
         this.AoVisibility.Clear();
         foreach (ArtObjectInstance artObjectInstance in this.LevelMaterializer.LevelArtObjects)
         {
             this.AoVisibility.Add(artObjectInstance.Visible);
             artObjectInstance.Visible = false;
             artObjectInstance.ArtObject.Group.Enabled = false;
         }
         for (int index = 0; index < 4; ++index)
         {
             ArtObjectInstance artObjectInstance = this.Rings[index];
             this.OriginalTextures[index] = artObjectInstance.ArtObject.Group.TextureMap;
             artObjectInstance.Visible    = true;
             artObjectInstance.ArtObject.Group.Enabled = true;
             artObjectInstance.ArtObject.Group.Texture = (Texture)this.WhiteTex;
             artObjectInstance.Material.Opacity        = Easing.EaseIn((double)FezMath.Saturate((float)(((double)this.SinceStarted - 19.0) / 18.0)), EasingType.Cubic);
             artObjectInstance.Update();
         }
         this.LevelMaterializer.ArtObjectsMesh.Draw();
         for (int index = 0; index < 4; ++index)
         {
             this.Rings[index].ArtObject.Group.Texture = (Texture)this.OriginalTextures[index];
             this.OriginalTextures[index]       = (Texture2D)null;
             this.Rings[index].Material.Opacity = 1f;
         }
         int num = 0;
         foreach (ArtObjectInstance artObjectInstance in this.LevelMaterializer.LevelArtObjects)
         {
             artObjectInstance.Visible = this.AoVisibility[num++];
             if (artObjectInstance.Visible)
             {
                 artObjectInstance.ArtObject.Group.Enabled = true;
             }
         }
     }
     if ((double)this.SinceStarted > 36.75)
     {
         if (this.Rings != null)
         {
             foreach (ArtObjectInstance aoInstance in this.Rings)
             {
                 this.LevelManager.RemoveArtObject(aoInstance);
             }
             this.maskRenderer.Visible             = true;
             this.LevelManager.Scripts[4].Disabled = false;
             this.LevelManager.Scripts[5].Disabled = false;
             this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(0);
         }
         this.Rings = (ArtObjectInstance[])null;
         float num = Easing.EaseIn(1.0 - (double)FezMath.Saturate((float)(((double)this.SinceStarted - 36.75) / 6.0)), EasingType.Sine);
         if (FezMath.AlmostEqual(num, 0.0f))
         {
             return;
         }
         this.TargetRenderer.DrawFullscreen(new Color(1f, 1f, 1f, num));
     }
     else
     {
         if ((double)this.SinceStarted <= 33.0)
         {
             return;
         }
         this.TargetRenderer.DrawFullscreen(new Color(1f, 1f, 1f, FezMath.Saturate(Easing.EaseIn(((double)this.TrialTimeAccumulator - 3.0) / 0.75, EasingType.Quintic))));
         this.TrialRaysMesh.Draw();
         this.TrialFlareMesh.Draw();
     }
 }
Ejemplo n.º 22
0
 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;
     }
 }
Ejemplo n.º 23
0
 private void RotateSkull()
 {
     this.InterpolatedRotation = Quaternion.Slerp(this.InterpolatedRotation, this.StopSkullRotations ? this.OriginalRotation : this.CameraManager.Rotation, 0.05f);
     if (this.InterpolatedRotation == this.CameraManager.Rotation)
     {
         if (this.eRumble.Cue.State != SoundState.Paused)
         {
             this.eRumble.Cue.Pause();
         }
         if (!this.StopSkullRotations)
         {
             return;
         }
         this.SkullRotates       = false;
         this.StopSkullRotations = false;
     }
     else
     {
         if (FezMath.AlmostEqual(this.InterpolatedRotation, this.CameraManager.Rotation) || FezMath.AlmostEqual(-this.InterpolatedRotation, this.CameraManager.Rotation))
         {
             this.InterpolatedRotation = this.CameraManager.Rotation;
         }
         this.SkullAo.Rotation = this.InterpolatedRotation * Quaternion.CreateFromAxisAngle(Vector3.UnitY, -1.570796f);
         Vector3 axis;
         float   angle1;
         TombstonesHost.ToAxisAngle(ref this.InterpolatedRotation, out axis, out angle1);
         float angle2 = this.lastAngle - angle1;
         if ((double)Math.Abs(angle2) > 0.100000001490116)
         {
             this.lastAngle = angle1;
         }
         else
         {
             for (int index = 0; index < this.SkullAttachedTriles.Length; ++index)
             {
                 TrileInstance instance = this.SkullAttachedTriles[index];
                 Vector4       vector   = this.SkullAttachedTrilesOriginalStates[index];
                 instance.Position = Vector3.Transform(FezMath.XYZ(vector) + new Vector3(0.5f) - this.SkullAo.Position, this.InterpolatedRotation) + this.SkullAo.Position - new Vector3(0.5f);
                 instance.Phi      = FezMath.WrapAngle(vector.W + ((double)axis.Y > 0.0 ? -1f : 1f) * angle1);
                 this.LevelMaterializer.GetTrileMaterializer(instance.Trile).UpdateInstance(instance);
             }
             if (Enumerable.Contains <TrileInstance>((IEnumerable <TrileInstance>) this.SkullTopLayer, this.PlayerManager.Ground.First))
             {
                 Vector3 position = this.PlayerManager.Position;
                 this.PlayerManager.Position = Vector3.Transform(this.PlayerManager.Position - this.SkullAo.Position, Quaternion.CreateFromAxisAngle(axis, angle2)) + this.SkullAo.Position;
                 IGameCameraManager cameraManager = this.CameraManager;
                 Vector3            vector3       = cameraManager.Center + this.PlayerManager.Position - position;
                 cameraManager.Center = vector3;
             }
             if ((double)Math.Abs(axis.Y) > 0.5)
             {
                 float num = angle2 * 5f;
                 IGameCameraManager cameraManager = this.CameraManager;
                 Vector3            vector3       = cameraManager.InterpolatedCenter + new Vector3(RandomHelper.Between(-(double)num, (double)num), RandomHelper.Between(-(double)num, (double)num), RandomHelper.Between(-(double)num, (double)num));
                 cameraManager.InterpolatedCenter = vector3;
                 if (this.eRumble.Cue.State == SoundState.Paused)
                 {
                     this.eRumble.Cue.Resume();
                 }
                 this.eRumble.VolumeFactor = FezMath.Saturate(Math.Abs(num) * 25f);
             }
             if (this.InterpolatedRotation == this.CameraManager.Rotation)
             {
                 this.RotateSkullTriles();
             }
             this.lastAngle = angle1;
         }
     }
 }
Ejemplo n.º 24
0
 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 || this.InputManager.Down == FezButtonState.Down && !FezMath.AlmostEqual(this.InputManager.Movement, Vector2.Zero, 0.5f))
         {
             break;
         }
         this.PlayerManager.Action = ActorTypeExtensions.IsLight(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) ? ActionType.Throwing : ActionType.ThrowingHeavy;
         this.thrown = false;
         break;
     }
 }
Ejemplo n.º 25
0
        private void Fly(TimeSpan elapsed)
        {
            if (!this.flyRight.HasValue)
            {
                this.flyRight = new Vector3?(Vector3.Transform(Vector3.Right, this.Group.Rotation));
            }
            if ((!this.FlyingBack || this.Npc.ActorType != ActorType.Owl) && FezMath.AlmostEqual(FezMath.Dot(FezMath.Abs(Vector3.Transform(Vector3.Right, this.Group.Rotation)), FezMath.Abs(this.flyRight.Value)), 0.0f, 0.1f))
            {
                NpcState npcState  = this;
                Vector3? nullable1 = npcState.flyRight;
                Vector3  vector3   = Vector3.Transform(Vector3.Right, this.Group.Rotation);
                Vector3? nullable2 = nullable1.HasValue ? new Vector3?(nullable1.GetValueOrDefault() + vector3) : new Vector3?();
                npcState.flyRight = nullable2;
            }
            this.flySpeed = Vector2.Lerp(this.flySpeed, new Vector2(4f, 3f), 0.03333334f);
            Vector2 vector2 = this.flySpeed * ((1f - FezMath.Frac(this.CurrentTiming.Step + 0.75f)) * new Vector2(0.4f, 0.6f) + new Vector2(0.6f, 0.4f));

            this.Position += (float)elapsed.TotalSeconds * (vector2.X * this.flyRight.Value + Vector3.Up * vector2.Y * (this.FlyingBack ? -1f : 1f));
            if (FezMath.IsOrthographic(this.CameraManager.Viewpoint) && this.CameraManager.ViewTransitionReached)
            {
                Vector3 b = FezMath.ForwardVector(this.CameraManager.Viewpoint);
                if (this.InBackground)
                {
                    b *= -1f;
                }
                NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.Position, QueryOptions.Simple);
                TrileInstance trileInstance = nearestTriles.Surface ?? nearestTriles.Deep;
                if (trileInstance != null)
                {
                    Vector3 a       = trileInstance.Center + trileInstance.TransformedSize / 2f * -b;
                    Vector3 vector3 = FezMath.DepthMask(this.CameraManager.Viewpoint);
                    if ((double)FezMath.Dot(this.Position, b) > (double)FezMath.Dot(a, b))
                    {
                        this.Position = this.Position * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) + a * vector3 - b;
                    }
                }
            }
            if (this.CurrentTiming.Frame == 0 && this.lastFrame != 0)
            {
                SoundEffectExtensions.EmitAt(this.flySound, this.Position);
            }
            this.lastFrame = this.CurrentTiming.Frame;
            if (this.FlyingBack)
            {
                if ((double)this.Position.Y > (double)this.Npc.Position.Y)
                {
                    return;
                }
                this.Position      = this.Npc.Position;
                this.CurrentAction = NpcAction.Land;
                this.flySpeed      = Vector2.Zero;
                this.UpdateAction();
                this.FlyingBack = false;
                this.flyRight   = new Vector3?();
            }
            else
            {
                if (this.CameraManager.Frustum.Contains(new BoundingBox(this.Position - Vector3.One, this.Position + Vector3.One)) != ContainmentType.Disjoint)
                {
                    return;
                }
                if (this.MayComeBack)
                {
                    this.OwlInvisible  = true;
                    this.MayComeBack   = false;
                    this.CurrentAction = NpcAction.Idle;
                    this.flySpeed      = Vector2.Zero;
                    this.flyRight      = new Vector3?();
                    this.UpdateAction();
                }
                else
                {
                    ServiceHelper.RemoveComponent <NpcState>(this);
                }
            }
        }
Ejemplo n.º 26
0
        private void FollowGomez()
        {
            float num1 = this.CameraManager.PixelsPerTrixel;

            if (this.GameState.FarawaySettings.InTransition && FezMath.AlmostEqual(this.GameState.FarawaySettings.DestinationCrossfadeStep, 1f))
            {
                num1 = MathHelper.Lerp(this.CameraManager.PixelsPerTrixel, this.GameState.FarawaySettings.DestinationPixelsPerTrixel, (float)(((double)this.GameState.FarawaySettings.TransitionStep - 0.875) / 0.125));
            }
            float   num2      = (float)(4.0 * (this.LevelManager.Descending ? -1.0 : 1.0)) / num1;
            Vector3 vector3_1 = new Vector3(this.CameraManager.Center.X, this.PlayerManager.Position.Y + num2, this.CameraManager.Center.Z);
            Vector3 center    = this.CameraManager.Center;

            if (this.CameraManager.StickyCam)
            {
                Vector3 vector3_2 = this.PlayerManager.Position + Vector3.UnitY * num2;
                Vector3 vector3_3 = this.StickyCenter * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) - vector3_2 * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);
                float   val1      = vector3_3.Length() + 1f;
                if (this.InputManager.FreeLook == Vector2.Zero)
                {
                    this.MinimumStickDistance = Math.Min(val1, this.MinimumStickDistance);
                    float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice);
                    if ((double)Math.Abs(vector3_3.X + vector3_3.Z) > (double)this.CameraManager.Radius * 0.400000005960464 / (double)viewScale || (double)Math.Abs(vector3_3.Y) > (double)this.CameraManager.Radius * 0.400000005960464 / (double)this.CameraManager.AspectRatio / (double)viewScale)
                    {
                        this.MinimumStickDistance = 2.5f;
                    }
                    if ((double)this.MinimumStickDistance < 4.0)
                    {
                        this.StickyCenter = Vector3.Lerp(this.StickyCenter, vector3_2, (float)Math.Pow(1.0 / (double)this.MinimumStickDistance, 4.0));
                    }
                }
                vector3_1 = this.StickyCenter;
                if ((double)val1 <= 1.1)
                {
                    this.CameraManager.StickyCam = false;
                }
            }
            else
            {
                if ((double)MathHelper.Clamp(this.PlayerManager.Position.X, center.X - 1.5f, center.X + 1.5f) != (double)this.PlayerManager.Position.X)
                {
                    float num3 = this.PlayerManager.Position.X - center.X;
                    vector3_1.X += num3 - 1.5f * (float)Math.Sign(num3);
                }
                if ((double)MathHelper.Clamp(this.PlayerManager.Position.Z, center.Z - 1.5f, center.Z + 1.5f) != (double)this.PlayerManager.Position.Z)
                {
                    float num3 = this.PlayerManager.Position.Z - this.CameraManager.Center.Z;
                    vector3_1.Z += num3 - 1.5f * (float)Math.Sign(num3);
                }
            }
            if (this.CameraManager.PanningConstraints.HasValue && !this.GameState.InMap)
            {
                Vector3 vector3_2 = FezMath.DepthMask(this.CameraManager.Viewpoint);
                Vector3 vector3_3 = FezMath.SideMask(this.CameraManager.Viewpoint);
                Vector3 vector3_4 = new Vector3(MathHelper.Lerp(this.CameraManager.ConstrainedCenter.X, vector3_1.X, this.CameraManager.PanningConstraints.Value.X), MathHelper.Lerp(this.CameraManager.ConstrainedCenter.Y, vector3_1.Y, this.CameraManager.PanningConstraints.Value.Y), MathHelper.Lerp(this.CameraManager.ConstrainedCenter.Z, vector3_1.Z, this.CameraManager.PanningConstraints.Value.X));
                this.CameraManager.Center = this.CameraManager.Center * vector3_2 + vector3_3 * vector3_4 + Vector3.UnitY * vector3_4;
            }
            else
            {
                if (this.GameState.InMenuCube || this.GameState.InMap || FezMath.In <ActionType>(this.PlayerManager.Action, ActionType.PullUpCornerLedge, ActionType.LowerToCornerLedge, ActionType.Victory, (IEqualityComparer <ActionType>)ActionTypeComparer.Default))
                {
                    return;
                }
                this.CameraManager.Center = vector3_1;
            }
        }
Ejemplo n.º 27
0
        private bool UpdateInternal(IPhysicsEntity entity, MultipleHits <CollisionResult> horizontalResults, MultipleHits <CollisionResult> verticalResults, Vector3?clampToGroundDistance, bool wasGrounded, bool hugWalls, bool velocityIrrelevant, bool simple)
        {
            Vector3 velocity = entity.Velocity;

            if (!simple)
            {
                MultipleHits <CollisionResult> multipleHits = new MultipleHits <CollisionResult>();
                if (BoxCollisionResultExtensions.AnyCollided(horizontalResults))
                {
                    if (horizontalResults.NearLow.Collided)
                    {
                        multipleHits.NearLow = horizontalResults.NearLow;
                    }
                    if (horizontalResults.FarHigh.Collided)
                    {
                        multipleHits.FarHigh = horizontalResults.FarHigh;
                    }
                }
                entity.WallCollision = multipleHits;
            }
            if (horizontalResults.NearLow.Collided)
            {
                velocity += horizontalResults.NearLow.Response;
            }
            else if (horizontalResults.FarHigh.Collided)
            {
                velocity += horizontalResults.FarHigh.Response;
            }
            if (verticalResults.NearLow.Collided)
            {
                velocity += verticalResults.NearLow.Response;
            }
            else if (verticalResults.FarHigh.Collided)
            {
                velocity += verticalResults.FarHigh.Response;
            }
            Vector3 vector3_1 = !(entity is IComplexPhysicsEntity) || !(entity as IComplexPhysicsEntity).Swimming ? (entity.Grounded || wasGrounded ? (entity.Sliding ? PhysicsManager.SlidingFrictionV : PhysicsManager.GroundFrictionV) : PhysicsManager.AirFrictionV) : PhysicsManager.WaterFrictionV;
            float   amount    = (float)((1.20000004768372 + (double)Math.Abs(this.CollisionManager.GravityFactor) * 0.800000011920929) / 2.0);
            Vector3 vector3_2 = FezMath.AlmostClamp(velocity * Vector3.Lerp(Vector3.One, vector3_1, amount), 1E-06f);

            if (!entity.NoVelocityClamping)
            {
                float max = entity is IComplexPhysicsEntity ? 0.4f : 0.38f;
                vector3_2.Y = MathHelper.Clamp(vector3_2.Y, -max, max);
            }
            Vector3 center = entity.Center;
            Vector3 a      = center + vector3_2;
            bool    flag   = !FezMath.AlmostEqual(a, center);

            entity.Velocity = vector3_2;
            if (flag)
            {
                entity.Center = a;
            }
            if (velocityIrrelevant || flag)
            {
                this.DetermineInBackground(entity, false, false, hugWalls);
                this.ClampToGround(entity, clampToGroundDistance, this.CameraManager.Viewpoint);
                if (hugWalls)
                {
                    this.HugWalls(entity, false, false, true);
                }
            }
            if (!simple && (!(entity is ISimplePhysicsEntity) || !(entity as ISimplePhysicsEntity).IgnoreCollision))
            {
                if (this.LevelManager.IsInvalidatingScreen)
                {
                    this.ScheduleRedefineCorners(entity);
                }
                else
                {
                    this.RedefineCorners(entity);
                }
            }
            return(flag);
        }
Ejemplo n.º 28
0
 private static Vector3 GetIntemediateVector(Vector3 from, Vector3 to)
 {
     return((!FezMath.AlmostEqual(FezMath.AngleBetween(from, to), 3.141593f) ? FezMath.Slerp(from, to, 0.5f) : Vector3.Cross(Vector3.Normalize(to - from), Vector3.UnitY)) + Vector3.UnitY * 0.0f);
 }
Ejemplo n.º 29
0
        public void DoDraw()
        {
            if (this.GameState.Loading || this.PlayerManager.Hidden || (this.GameState.InMap || FezMath.AlmostEqual(this.PlayerManager.GomezOpacity, 0.0f)))
            {
                return;
            }
            if (this.GameState.StereoMode || this.LevelManager.Quantum)
            {
                this.PlayerManager.Mesh.Rotation = FezMath.IsOrthographic(this.CameraManager.Viewpoint) || this.CameraManager.LastViewpoint == Viewpoint.None ? this.CameraManager.Rotation : Quaternion.CreateFromAxisAngle(Vector3.UnitY, FezMath.ToPhi(this.CameraManager.LastViewpoint));
                if (this.PlayerManager.LookingDirection == HorizontalDirection.Left)
                {
                    this.PlayerManager.Mesh.Rotation *= FezMath.QuaternionFromPhi(3.141593f);
                }
            }
            this.PlayerManager.Mesh.Material.Opacity = this.PlayerManager.Action == ActionType.Suffering || this.PlayerManager.Action == ActionType.Sinking ? (float)FezMath.Saturate((Math.Sin((double)this.PlayerManager.BlinkSpeed * 6.28318548202515 * 5.0) + 0.5 - (double)this.PlayerManager.BlinkSpeed * 1.25) * 2.0) : this.PlayerManager.GomezOpacity;
            GraphicsDevice graphicsDevice = this.GraphicsDevice;

            if (!ActionTypeExtensions.SkipSilhouette(this.PlayerManager.Action))
            {
                GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.Greater, StencilMask.NoSilhouette);
                this.playerMesh.DepthWrites = false;
                this.playerMesh.AlwaysOnTop = true;
                this.effect.Silhouette      = true;
                this.playerMesh.Draw();
            }
            if (!this.PlayerManager.Background)
            {
                GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.Equal, StencilMask.Hole);
                this.playerMesh.AlwaysOnTop = true;
                this.playerMesh.DepthWrites = false;
                this.effect.Silhouette      = false;
                this.playerMesh.Draw();
            }
            GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.Gomez));
            this.playerMesh.AlwaysOnTop = ActionTypeExtensions.NeedsAlwaysOnTop(this.PlayerManager.Action);
            this.playerMesh.DepthWrites = true;
            this.effect.Silhouette      = false;
            this.playerMesh.Draw();
            GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.None));
        }
Ejemplo n.º 30
0
            public void Update(TimeSpan elapsed)
            {
                float num = this.LevelManager.WaterHeight - 0.5f;

                if (this.BubblingEmitter != null)
                {
                    bool flag = !this.GameState.FarawaySettings.InTransition && !ActionTypeExtensions.IsEnteringDoor(this.PlayerManager.Action);
                    this.sinceAlive = FezMath.Saturate(this.sinceAlive + (float)(elapsed.TotalSeconds / 2.0 * (flag ? 1.0 : -1.0)));
                }
                if ((double)this.TerminalPosition.Y <= (double)num)
                {
                    float b = this.Top - num;
                    if ((double)b <= 0.0)
                    {
                        if (!this.Splash.Hidden)
                        {
                            this.ParticleSystem.Enabled = this.ParticleSystem.Visible = false;
                            this.Splash.Hidden          = true;
                            this.Plane.Hidden           = true;
                            foreach (BackgroundPlane backgroundPlane in this.AttachedPlanes)
                            {
                                backgroundPlane.Hidden = true;
                            }
                        }
                        if (this.BubblingEmitter == null)
                        {
                            return;
                        }
                        this.BubblingEmitter.VolumeFactor = 0.0f;
                    }
                    else
                    {
                        if (this.Splash.Hidden)
                        {
                            this.ParticleSystem.Enabled = this.ParticleSystem.Visible = true;
                            this.Splash.Hidden          = false;
                            this.Plane.Hidden           = false;
                            foreach (BackgroundPlane backgroundPlane in this.AttachedPlanes)
                            {
                                backgroundPlane.Hidden = false;
                            }
                        }
                        if (this.BubblingEmitter != null)
                        {
                            this.BubblingEmitter.VolumeFactor = FezMath.Saturate(b / 2f) * this.sinceAlive;
                            if (this.LevelManager.WaterType != LiquidType.None)
                            {
                                this.BubblingEmitter.Position = FezMath.XZMask * this.TerminalPosition + num * Vector3.UnitY;
                            }
                        }
                        this.Splash.Position = new Vector3(this.TerminalPosition.X, num + this.Splash.Size.Y / 2f, this.TerminalPosition.Z);
                        if (FezMath.AlmostEqual(this.lastDistToTop, b, 1.0 / 16.0))
                        {
                            return;
                        }
                        foreach (BackgroundPlane backgroundPlane in this.AttachedPlanes)
                        {
                            backgroundPlane.Scale    = new Vector3(backgroundPlane.Scale.X, b / backgroundPlane.Size.Y, backgroundPlane.Scale.Z);
                            backgroundPlane.Position = new Vector3(backgroundPlane.Position.X, num + b / 2f, backgroundPlane.Position.Z);
                        }
                        this.Plane.Scale    = new Vector3(this.Plane.Scale.X, b / this.Plane.Size.Y, this.Plane.Scale.Z);
                        this.Plane.Position = new Vector3(this.Plane.Position.X, num + b / 2f, this.Plane.Position.Z);
                        this.lastDistToTop  = b;
                    }
                }
                else
                {
                    if (this.Splash.Hidden)
                    {
                        return;
                    }
                    this.Splash.Hidden = true;
                }
            }