Esempio n. 1
0
        public override void Update(GameTime gameTime)
        {
            if (this.ReverseTiming)
            {
                this.sinceStarted -= gameTime.ElapsedGameTime;
                this.sinceStarted -= gameTime.ElapsedGameTime;
            }
            else
            {
                this.sinceStarted += gameTime.ElapsedGameTime;
            }
            float num = Easing.EaseIn(this.sinceStarted.TotalSeconds / 3.0, EasingType.Quartic);

            if (this.HasHorizontalTrails)
            {
                (this.TrailsMesh.Effect as HorizontalTrailsEffect).Timing = (float)this.sinceStarted.TotalSeconds;
            }
            if (!this.FollowCamera)
            {
                this.AdditionalZoom  = (float)FezMath.AsNumeric(this.HasZoomed) + num / 3f;
                this.AdditionalScale = num / 6f;
            }
            if (!this.HasHorizontalTrails && (double)num > 40.0 && !this.Done)
            {
                this.Done = true;
                ServiceHelper.RemoveComponent <StarField>(this);
            }
            if (!this.HasHorizontalTrails || !(this.sinceStarted <= TimeSpan.Zero))
            {
                return;
            }
            this.Enabled      = false;
            this.sinceStarted = TimeSpan.Zero;
        }
Esempio n. 2
0
 private void ChooseIdle()
 {
     if (NpcActionExtensions.IsSpecialIdle(this.CurrentAction))
     {
         this.CurrentAction = NpcAction.Idle;
     }
     else
     {
         float num1 = RandomHelper.Unit();
         float num2 = (float)(1 + FezMath.AsNumeric(this.CanIdle2) + FezMath.AsNumeric(this.CanIdle3));
         if ((double)num1 < 1.0 / (double)num2)
         {
             this.CurrentAction = NpcAction.Idle;
         }
         else if ((double)num2 > 1.0 && (double)num1 < 2.0 / (double)num2)
         {
             this.CurrentAction = this.CanIdle2 ? NpcAction.Idle2 : NpcAction.Idle3;
         }
         else
         {
             if ((double)num2 <= 2.0 || (double)num1 >= 3.0 / (double)num2)
             {
                 return;
             }
             this.CurrentAction = NpcAction.Idle3;
         }
     }
 }
Esempio n. 3
0
        private void FadeBits()
        {
            if (this.sinceClose.Ticks == 0L)
            {
                return;
            }
            this.InitBitPlanes();
            Vector3 position = this.AoInstance.Position;
            Vector3 vector3  = new Vector3(0.0f, 0.0f, 1f);

            for (int index = 0; index < this.BitPlanes.Count; ++index)
            {
                Vector3 vec = vector3;
                switch (this.BitPlanes.Count)
                {
                case 16:
                    vec += new Vector3(-0.5f, -1.5f, 0.0f) + this.SixteenOffsets[index];
                    break;

                case 32:
                    vec += new Vector3(-9.0 / 16.0, -21.0 / 16.0, 0.0f) + this.ThirtyTwoOffsets[index];
                    break;

                case 64:
                    vec += new Vector3(-0.625f, -1.625f, 0.0f) + this.SixtyFourOffsets[index];
                    break;

                case 2:
                    vec += new Vector3(0.0f, (float)(0.25 - (double)index * 0.5), 0.0f);
                    break;

                case 4:
                    vec += new Vector3(0.0f, -1f, 0.0f) + this.FourOffsets[index];
                    break;

                case 8:
                    vec += new Vector3(-0.5f, -0.75f, 0.0f) + this.EightOffsets[index];
                    break;
                }
                int num = this.GameState.SaveData.CubeShards + this.GameState.SaveData.SecretCubes;
                this.BitPlanes[index].Position = position + Vector3.Transform(vec, this.AoInstance.Rotation);
                float opacity = this.BitPlanes[index].Opacity;
                this.BitPlanes[index].Opacity = (float)FezMath.AsNumeric(num > index) * Easing.EaseIn(FezMath.Saturate(this.sinceClose.TotalSeconds * 2.0 - (double)index / ((double)this.BitPlanes.Count * 0.666000008583069 + 3.99600005149841)), EasingType.Sine);
                if ((double)this.BitPlanes[index].Opacity > (double)opacity && (double)opacity > 0.100000001490116 && this.BitPlanes[index].Loop)
                {
                    SoundEffectExtensions.EmitAt(this.sLightUp, position);
                    this.BitPlanes[index].Loop = false;
                }
                else if ((double)this.BitPlanes[index].Opacity < (double)opacity && !this.BitPlanes[index].Loop)
                {
                    SoundEffectExtensions.EmitAt(this.sFadeOut, position);
                    this.BitPlanes[index].Loop = true;
                }
            }
        }
Esempio n. 4
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Paused || this.GameState.InMap || (this.GameState.Loading || this.GameState.InMenuCube))
            {
                return;
            }
            this.TimeAccumulator        += (float)gameTime.ElapsedGameTime.TotalSeconds;
            this.WireHeart.Position      = this.CrumblingHeart.Position = TempleOfLoveHost.HeartCenter + Vector3.UnitY * (float)Math.Sin((double)this.TimeAccumulator / 2.0) / 2f;
            this.WireHeart.Rotation     *= Quaternion.CreateFromAxisAngle(Vector3.UnitY, (float)(gameTime.ElapsedGameTime.TotalSeconds / 2.0));
            this.CrumblingHeart.Rotation = this.WireHeart.Rotation;
            if (this.GameState.SaveData.HasDoneHeartReboot && this.Phase == TempleOfLoveHost.Phases.None)
            {
                this.Phase = TempleOfLoveHost.Phases.CrumbleOut;
            }
            switch (this.Phase)
            {
            case TempleOfLoveHost.Phases.CrumbleOut:
                this.PhaseTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
                foreach (Group group in this.CrumblingHeart.Groups)
                {
                    Vector3 vector = (Vector3)group.CustomData;
                    float   y      = (float)Math.Pow((double)Math.Max(this.PhaseTime - (float)(1.0 - ((double)vector.Y * 2.0 + (double)vector.Z + (double)vector.X)), 0.0f) * 0.875, 2.0);
                    group.Position = new Vector3(0.0f, y, 0.0f) + vector * y / 5f;
                    group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Normalize(vector), y / 10f);
                }
                this.WireHeartFactor = MathHelper.Lerp(this.WireHeartFactor, (float)(1 - FezMath.AsNumeric(RandomHelper.Probability((double)this.PhaseTime / 7.0))), (float)(0.125 + (double)this.PhaseTime / 7.0 * 0.200000002980232));
                if ((double)this.PhaseTime <= 7.0)
                {
                    break;
                }
                this.PhaseTime       = 0.0f;
                this.WireHeartFactor = 0.0f;
                this.Phase           = TempleOfLoveHost.Phases.ShineReboot;
                this.SoundManager.PlayNewSong((string)null, 4f);
                this.SoundManager.MuteAmbienceTracks();
                this.SoundManager.KillSounds(4f);
                SoundEffectExtensions.Emit(this.sRayWhiteout);
                break;

            case TempleOfLoveHost.Phases.ShineReboot:
                this.PhaseTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
                foreach (Group group in this.CrumblingHeart.Groups)
                {
                    Vector3 vector = (Vector3)group.CustomData;
                    float   y      = (float)Math.Pow((double)Math.Max(this.PhaseTime + 7f - (float)(1.0 - ((double)vector.Y * 2.0 + (double)vector.Z + (double)vector.X)), 0.0f) * 0.875, 2.0);
                    group.Position = new Vector3(0.0f, y, 0.0f) + vector * y / 5f;
                    group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Normalize(vector), y / 10f);
                }
                this.UpdateRays((float)gameTime.ElapsedGameTime.TotalSeconds);
                if ((double)this.PhaseTime <= 4.0)
                {
                    break;
                }
                this.SmoothReboot();
                break;
            }
        }
Esempio n. 5
0
 public override void Update(GameTime gameTime)
 {
     if (this.GameState.Loading)
     {
         return;
     }
     if (this.MoveUp)
     {
         if (this.eRumble == null)
         {
             this.eRumble = SoundEffectExtensions.EmitAt(this.sRumble, this.DoorAo.Position, true, 0.0f, 0.625f);
             Waiters.Wait(1.25, (Action)(() => this.eRumble.FadeOutAndDie(0.25f))).AutoPause = true;
         }
         this.DoMoveUp(gameTime.ElapsedGameTime);
     }
     else
     {
         if (!this.DoorAo.Visible || this.DoorAo.ActorSettings.Inactive || (this.CameraManager.Viewpoint != this.ExpectedViewpoint || this.PlayerManager.Background))
         {
             return;
         }
         Vector3 vector3 = FezMath.Abs(this.DoorAo.Position - this.PlayerManager.Position) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);
         bool    b       = (double)vector3.X + (double)vector3.Z < 0.75 && (double)vector3.Y < 2.0 && (double)FezMath.Dot(this.DoorAo.Position - this.PlayerManager.Position, FezMath.ForwardVector(this.CameraManager.Viewpoint)) >= 0.0;
         float   opacity = this.GlowPlane.Opacity;
         this.GlowPlane.Opacity = MathHelper.Lerp(this.GlowPlane.Opacity, (float)FezMath.AsNumeric(b), 0.05f);
         if ((double)this.GlowPlane.Opacity > (double)opacity && (double)opacity > 0.100000001490116 && this.loop)
         {
             SoundEffectExtensions.EmitAt(this.sLightUp, this.DoorAo.Position);
             this.loop = false;
         }
         else if ((double)this.GlowPlane.Opacity < (double)opacity && !this.loop)
         {
             SoundEffectExtensions.EmitAt(this.sFadeOut, this.DoorAo.Position);
             this.loop = true;
         }
         if (!b || !this.PlayerManager.Grounded || this.InputManager.ExactUp != FezButtonState.Pressed)
         {
             return;
         }
         this.Open();
     }
 }
Esempio n. 6
0
        public override void Draw(GameTime gameTime)
        {
            if (this.GameState.Loading || this.GameState.Paused)
            {
                if (this.RtHandle == null || !this.TargetRenderer.IsHooked(this.RtHandle.Target))
                {
                    return;
                }
                this.TargetRenderer.Resolve(this.RtHandle.Target, true);
                this.TargetRenderer.DrawFullscreen(Color.Black);
            }
            else
            {
                switch (this.ActivePhase)
                {
                case FinalRebuildHost.Phases.ZoomInNega:
                    this.TargetRenderer.DrawFullscreen(new Color(0.0f, 0.0f, 0.0f, 1f - Easing.EaseOut((double)FezMath.Saturate(this.PhaseTime / 10f), EasingType.Quadratic)));
                    this.TargetRenderer.Resolve(this.RtHandle.Target, true);
                    this.TargetRenderer.DrawFullscreen((BaseEffect)this.InvertEffect, (Texture)this.RtHandle.Target);
                    break;

                case FinalRebuildHost.Phases.FlickerIn:
                    float num = Easing.EaseIn((double)FezMath.Saturate(this.PhaseTime / 1.25f), EasingType.Quadratic);
                    if (RandomHelper.Probability(0.5))
                    {
                        this.WhiteCube.Material.Diffuse = new Vector3((float)FezMath.AsNumeric(RandomHelper.Probability((double)num)), (float)FezMath.AsNumeric(RandomHelper.Probability((double)num)), (float)FezMath.AsNumeric(RandomHelper.Probability((double)num)));
                    }
                    this.WhiteCube.Enabled = true;
                    this.WhiteCube.Draw();
                    this.TargetRenderer.Resolve(this.RtHandle.Target, true);
                    this.TargetRenderer.DrawFullscreen((BaseEffect)this.InvertEffect, (Texture)this.RtHandle.Target);
                    break;

                case FinalRebuildHost.Phases.SpinFill:
                    this.WhiteCube.Draw();
                    this.SolidCubes.Draw();
                    this.TargetRenderer.Resolve(this.RtHandle.Target, true);
                    this.TargetRenderer.DrawFullscreen((BaseEffect)this.InvertEffect, (Texture)this.RtHandle.Target);
                    break;

                case FinalRebuildHost.Phases.MotorStart1:
                case FinalRebuildHost.Phases.MotorStart2:
                case FinalRebuildHost.Phases.MotorStart3:
                case FinalRebuildHost.Phases.SmoothStart:
                    if (!this.HexahedronAo.Visible)
                    {
                        this.WhiteCube.Draw();
                        this.SolidCubes.Draw();
                        if (this.TargetRenderer.IsHooked(this.RtHandle.Target))
                        {
                            this.TargetRenderer.Resolve(this.RtHandle.Target, true);
                            this.TargetRenderer.DrawFullscreen((BaseEffect)this.InvertEffect, (Texture)this.RtHandle.Target);
                            break;
                        }
                        else
                        {
                            this.TargetRenderer.ScheduleHook(this.DrawOrder, this.RtHandle.Target);
                            break;
                        }
                    }
                    else
                    {
                        if (!this.TargetRenderer.IsHooked(this.RtHandle.Target))
                        {
                            break;
                        }
                        this.TargetRenderer.Resolve(this.RtHandle.Target, false);
                        this.TargetRenderer.DrawFullscreen((Texture)this.RtHandle.Target);
                        break;
                    }

                case FinalRebuildHost.Phases.ShineReboot:
                    this.RaysMesh.Draw();
                    this.FlareMesh.Draw();
                    break;
                }
            }
        }
Esempio n. 7
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Loading || this.GameState.Paused)
            {
                return;
            }
            if (this.FirstUpdate)
            {
                gameTime         = new GameTime();
                this.FirstUpdate = false;
            }
            this.PhaseTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
            switch (this.ActivePhase)
            {
            case FinalRebuildHost.Phases.ZoomInNega:
                this.GameState.SkipRendering = true;
                if (gameTime.ElapsedGameTime.Ticks == 0L)
                {
                    this.Glitches.ActiveGlitches       = 0;
                    this.Glitches.FreezeProbability    = 0.0f;
                    this.CameraManager.PixelsPerTrixel = 0.5f;
                    this.CameraManager.SnapInterpolation();
                    this.PlayerManager.Position         = Vector3.Zero;
                    this.PlayerManager.LookingDirection = HorizontalDirection.Right;
                    this.SetHexVisible(false);
                    this.CollisionManager.GravityFactor = 1f;
                    SoundEffectExtensions.Emit(this.sZoomIn);
                    this.eAmbient = SoundEffectExtensions.Emit(this.sAmbientDrone, true, 0.0f, 0.0f);
                }
                float amount = Easing.EaseIn((double)FezMath.Saturate(this.PhaseTime / 10f), EasingType.Sine);
                if ((double)this.PhaseTime > 0.25)
                {
                    IGameCameraManager cameraManager = this.CameraManager;
                    double             num           = (double)cameraManager.Radius * (double)MathHelper.Lerp(0.99f, 1f, amount);
                    cameraManager.Radius = (float)num;
                }
                this.PlayerManager.Action   = (double)this.PhaseTime > 7.0 ? ActionType.StandWinking : ActionType.Standing;
                this.PlayerManager.Velocity = Vector3.Zero;
                float num1 = Easing.EaseIn((double)FezMath.Saturate(this.PhaseTime / 11f), EasingType.Sine);
                this.CameraManager.Center = this.PlayerManager.Position + new Vector3(0.0f, 0.125f, 0.0f) + new Vector3(0.0f, (float)(Math.Sin((double)this.PhaseTime) * 0.25 * (1.0 - (double)num1)), 0.0f);
                this.CameraManager.SnapInterpolation();
                this.GameState.SkipRendering = false;
                this.eAmbient.VolumeFactor   = num1;
                if ((double)this.PhaseTime <= 11.0)
                {
                    break;
                }
                Waiters.Wait(0.75, (Action)(() => SoundEffectExtensions.Emit(this.sHexAppear))).AutoPause = true;
                this.ChangePhase();
                break;

            case FinalRebuildHost.Phases.FlickerIn:
                this.GameState.SkipRendering = true;
                if (gameTime.ElapsedGameTime.Ticks == 0L)
                {
                    this.WhiteCube.Material.Diffuse    = Vector3.Zero;
                    this.WhiteCube.Rotation            = this.OriginalCubeRotation;
                    this.CameraManager.PixelsPerTrixel = 3f;
                    this.CameraManager.SnapInterpolation();
                    this.PlayerManager.Position = Vector3.Zero;
                    if (this.eAmbient != null)
                    {
                        this.eAmbient.VolumeFactor = 0.625f;
                    }
                    this.PhaseTime = -1f;
                }
                this.PlayerManager.Action   = ActionType.Standing;
                this.PlayerManager.Velocity = Vector3.Zero;
                this.CameraManager.Center   = this.PlayerManager.Position + new Vector3(0.0f, 4.5f, 0.0f);
                this.CameraManager.SnapInterpolation();
                this.GameState.SkipRendering = false;
                this.WhiteCube.Position      = this.PlayerManager.Position + new Vector3(0.0f, 6f, 0.0f);
                if ((double)this.PhaseTime <= 2.25)
                {
                    break;
                }
                this.ChangePhase();
                break;

            case FinalRebuildHost.Phases.SpinFill:
                this.GameState.SkipRendering = true;
                if (gameTime.ElapsedGameTime.Ticks == 0L)
                {
                    this.CameraManager.PixelsPerTrixel = 3f;
                    this.CameraManager.SnapInterpolation();
                    this.PlayerManager.Position     = Vector3.Zero;
                    this.WhiteCube.Material.Diffuse = Vector3.One;
                    for (int index = 0; index < this.SolidCubes.Groups.Count; ++index)
                    {
                        this.SolidCubes.Groups[index].CustomData = (object)null;
                    }
                }
                this.PlayerManager.Action   = ActionType.Standing;
                this.PlayerManager.Velocity = Vector3.Zero;
                this.CameraManager.Center   = this.PlayerManager.Position + new Vector3(0.0f, 4.5f, 0.0f);
                this.CameraManager.SnapInterpolation();
                this.GameState.SkipRendering = false;
                float num2 = Easing.EaseInOut((double)FezMath.Saturate(this.PhaseTime / 11f), EasingType.Sine);
                this.SolidCubes.Position = this.WhiteCube.Position = this.PlayerManager.Position + new Vector3(0.0f, 6f, 0.0f);
                this.SolidCubes.Rotation = this.WhiteCube.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitY, (float)((double)num2 * 6.28318548202515 * 3.0)) * this.OriginalCubeRotation;
                float num3  = Easing.EaseInOut((double)FezMath.Saturate(this.PhaseTime / 10f), EasingType.Quadratic);
                float pitch = MathHelper.Clamp((float)(((double)num3 - (double)this.lastStep) * 200.0 - 0.200000002980232), -1f, 1f);
                float num4  = 1f / (float)this.SolidCubes.Groups.Count;
                for (int index = 0; index < this.SolidCubes.Groups.Count; ++index)
                {
                    float num5 = (float)index / (float)this.SolidCubes.Groups.Count;
                    float num6 = Easing.EaseIn((double)FezMath.Saturate((num3 - num5) / num4), EasingType.Sine);
                    if ((double)num6 == 1.0)
                    {
                        this.SolidCubes.Groups[index].Material.Diffuse = Vector3.One;
                        this.SolidCubes.Groups[index].Enabled          = true;
                    }
                    else if ((double)num6 == 0.0)
                    {
                        this.SolidCubes.Groups[index].Enabled = false;
                    }
                    else
                    {
                        if ((double)num6 > 0.125 && this.SolidCubes.Groups[index].CustomData == null)
                        {
                            SoundEffectExtensions.Emit(this.sCubeAppear, pitch);
                            this.SolidCubes.Groups[index].CustomData = (object)true;
                        }
                        this.SolidCubes.Groups[index].Material.Diffuse = new Vector3((float)FezMath.AsNumeric(RandomHelper.Probability((double)num6)), (float)FezMath.AsNumeric(RandomHelper.Probability((double)num6)), (float)FezMath.AsNumeric(RandomHelper.Probability((double)num6)));
                        this.SolidCubes.Groups[index].Enabled          = RandomHelper.Probability((double)num6);
                    }
                }
                this.lastStep = num3;
                if ((double)this.PhaseTime <= 12.0)
                {
                    break;
                }
                this.eMotor   = SoundEffectExtensions.Emit(this.sMotorSpin1);
                this.eAku     = SoundEffectExtensions.Emit(this.sAku, true, 0.0f, 0.0f);
                this.lastStep = 0.0f;
                this.ChangePhase();
                break;

            case FinalRebuildHost.Phases.MotorStart1:
                this.GameState.SkipRendering = true;
                if (gameTime.ElapsedGameTime.Ticks == 0L)
                {
                    this.HexahedronAo.Position = this.SolidCubes.Position;
                    this.lastStep = 0.0f;
                    for (int index = 0; index < this.SolidCubes.Groups.Count; ++index)
                    {
                        this.SolidCubes.Groups[index].Enabled          = true;
                        this.SolidCubes.Groups[index].Material.Diffuse = Vector3.One;
                    }
                    this.SolidCubes.Rotation = Quaternion.Identity;
                    this.SolidCubes.Position = Vector3.Zero;
                    this.SolidCubes.CollapseToBufferWithNormal <VertexPositionNormalTextureInstance>();
                    this.SolidCubes.Position = this.PlayerManager.Position + new Vector3(0.0f, 6f, 0.0f);
                }
                this.PlayerManager.Action   = ActionType.Standing;
                this.PlayerManager.Velocity = Vector3.Zero;
                this.CameraManager.Center   = this.PlayerManager.Position + new Vector3(0.0f, 4.5f, 0.0f);
                this.CameraManager.SnapInterpolation();
                this.GameState.SkipRendering = false;
                float num7 = Easing.EaseIn((double)Easing.EaseOut((double)FezMath.Saturate(this.PhaseTime / 5f), EasingType.Sine), EasingType.Sextic);
                this.SetHexVisible((double)num7 - (double)this.lastStep > 0.00825);
                this.lastStep            = num7;
                this.SolidCubes.Rotation = this.WhiteCube.Rotation = this.HexahedronAo.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitY, (float)((double)num7 * 6.28318548202515 * 4.0)) * this.OriginalCubeRotation;
                if ((double)this.PhaseTime <= 5.0)
                {
                    break;
                }
                this.eMotor = SoundEffectExtensions.Emit(this.sMotorSpin2);
                this.ChangePhase();
                break;

            case FinalRebuildHost.Phases.MotorStart2:
                this.GameState.SkipRendering = true;
                if (gameTime.ElapsedGameTime.Ticks == 0L)
                {
                    this.HexahedronAo.Position = this.SolidCubes.Position;
                    this.lastStep = 0.0f;
                }
                this.PlayerManager.Action   = ActionType.Standing;
                this.PlayerManager.Velocity = Vector3.Zero;
                this.CameraManager.Center   = this.PlayerManager.Position + new Vector3(0.0f, 4.5f, 0.0f);
                this.CameraManager.SnapInterpolation();
                this.GameState.SkipRendering = false;
                float num8 = Easing.EaseIn((double)Easing.EaseOut((double)FezMath.Saturate(this.PhaseTime / 4f), EasingType.Sine), EasingType.Sextic);
                float num9 = num8 - this.lastStep;
                this.SetHexVisible((double)num9 > 0.01);
                this.lastStep = num8;
                if (this.GameState.SaveData.SecretCubes + this.GameState.SaveData.CubeShards < 64)
                {
                    this.Glitches.DisappearProbability = 0.05f;
                    float num5 = Easing.EaseIn((double)num9 / 0.00999999977648258, EasingType.Quartic);
                    this.Glitches.ActiveGlitches    = FezMath.Round((double)num5 * 7.0 + (double)(int)RandomHelper.Between(0.0, (double)num5 * 10.0));
                    this.Glitches.FreezeProbability = (float)((double)num9 / 0.00999999977648258 * (1.0 / 400.0));
                }
                this.SolidCubes.Rotation = this.WhiteCube.Rotation = this.HexahedronAo.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitY, (float)((double)num8 * 6.28318548202515 * 5.0)) * this.OriginalCubeRotation;
                if ((double)this.PhaseTime <= 4.0 + (this.GameState.SaveData.SecretCubes + this.GameState.SaveData.CubeShards >= 64 ? 0.5 : 0.0))
                {
                    break;
                }
                if (this.GameState.SaveData.SecretCubes + this.GameState.SaveData.CubeShards < 64)
                {
                    this.eMotor = SoundEffectExtensions.Emit(this.sMotorSpinCrash);
                    this.ChangePhase();
                    break;
                }
                else
                {
                    this.eMotor = SoundEffectExtensions.Emit(this.sMotorSpinAOK);
                    this.ChangePhaseTo(FinalRebuildHost.Phases.SmoothStart);
                    break;
                }

            case FinalRebuildHost.Phases.MotorStart3:
                this.GameState.SkipRendering = true;
                if (gameTime.ElapsedGameTime.Ticks == 0L)
                {
                    this.HexahedronAo.Position = this.SolidCubes.Position;
                }
                this.PlayerManager.Action   = ActionType.Standing;
                this.PlayerManager.Velocity = Vector3.Zero;
                this.CameraManager.Center   = this.PlayerManager.Position + new Vector3(0.0f, 4.5f, 0.0f);
                this.CameraManager.SnapInterpolation();
                this.GameState.SkipRendering = false;
                float num10 = Easing.EaseIn((double)this.PhaseTime / 6.0, EasingType.Sextic);
                float num11 = Math.Min(num10 - this.lastStep, 0.05f);
                this.SetHexVisible((double)num11 > 1.0 / 80.0);
                this.lastStep = num10;
                this.Glitches.DisappearProbability = 0.0375f;
                float num12 = Easing.EaseIn((double)num11 / 0.0375000014901161, EasingType.Quartic);
                this.Glitches.ActiveGlitches    = FezMath.Round((double)FezMath.Saturate(num12) * 500.0 + (double)(int)RandomHelper.Between(0.0, (double)FezMath.Saturate(num12) * 250.0));
                this.Glitches.FreezeProbability = Easing.EaseIn((double)num11 / 0.0500000007450581, EasingType.Quadratic) * 0.15f;
                this.SolidCubes.Rotation        = this.WhiteCube.Rotation = this.HexahedronAo.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitY, (float)((double)num10 * 6.28318548202515 * 20.0)) * this.OriginalCubeRotation;
                if ((double)this.PhaseTime <= 8.0)
                {
                    break;
                }
                this.ChangePhase();
                break;

            case FinalRebuildHost.Phases.Crash:
                this.Glitches.FreezeProbability = 1f;
                if ((double)this.PhaseTime <= 2.0)
                {
                    break;
                }
                if (this.eAku != null)
                {
                    this.eAku.FadeOutAndDie(0.0f);
                }
                if (this.eAmbient != null)
                {
                    this.eAmbient.FadeOutAndDie(0.0f, false);
                }
                this.Glitches.ActiveGlitches       = 0;
                this.Glitches.FreezeProbability    = 0.0f;
                this.Glitches.DisappearProbability = 0.0f;
                this.GlitchReboot();
                break;

            case FinalRebuildHost.Phases.SmoothStart:
                this.GameState.SkipRendering = true;
                if (gameTime.ElapsedGameTime.Ticks == 0L)
                {
                    this.HexahedronAo.Position = this.SolidCubes.Position;
                    this.lastStep = 0.0f;
                    for (int index = 0; index < this.SolidCubes.Groups.Count; ++index)
                    {
                        this.SolidCubes.Groups[index].Enabled = true;
                    }
                }
                this.PlayerManager.Action   = ActionType.Standing;
                this.PlayerManager.Velocity = Vector3.Zero;
                this.CameraManager.Center   = this.PlayerManager.Position + new Vector3(0.0f, 4.5f, 0.0f);
                this.CameraManager.SnapInterpolation();
                this.GameState.SkipRendering = false;
                float num13 = Easing.EaseInOut((double)FezMath.Saturate(this.PhaseTime / 10f), EasingType.Quadratic);
                this.SetHexVisible((double)num13 > 0.425000011920929);
                this.lastStep            = num13;
                this.SolidCubes.Rotation = this.WhiteCube.Rotation = this.HexahedronAo.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitY, (float)((double)num13 * 6.28318548202515 * 18.0)) * this.OriginalCubeRotation;
                if ((double)this.PhaseTime <= 10.0)
                {
                    break;
                }
                this.eAku.FadeOutAndDie(2f);
                SoundEffectExtensions.Emit(this.sRayWhiteout);
                this.ChangePhase();
                break;

            case FinalRebuildHost.Phases.ShineReboot:
                this.GameState.SkipRendering = true;
                if (gameTime.ElapsedGameTime.Ticks == 0L)
                {
                    this.HexahedronAo.Position = this.SolidCubes.Position;
                    this.SetHexVisible(true);
                    this.RaysMesh.ClearGroups();
                    this.HexahedronAo.Rotation = this.OriginalCubeRotation;
                    if (this.eAmbient != null)
                    {
                        this.eAmbient.FadeOutAndDie(0.0f, false);
                    }
                }
                this.PlayerManager.Action   = ActionType.Standing;
                this.PlayerManager.Velocity = Vector3.Zero;
                this.CameraManager.Center   = this.PlayerManager.Position + new Vector3(0.0f, 4.5f, 0.0f);
                this.CameraManager.SnapInterpolation();
                this.GameState.SkipRendering = false;
                this.UpdateRays((float)gameTime.ElapsedGameTime.TotalSeconds);
                if ((double)this.PhaseTime <= 4.0)
                {
                    break;
                }
                this.SmoothReboot();
                break;
            }
        }
Esempio n. 8
0
        private void SpawnDust(TrileInstance instance, float opacity, AnimatedTexture animation, bool onRight, bool onLeft)
        {
            float num1 = (float)((double)instance.Center.Y - (double)instance.TransformedSize.Y / 2.0 * (double)Math.Sign(this.CollisionManager.GravityFactor) + (double)animation.FrameHeight / 32.0 * (double)Math.Sign(this.CollisionManager.GravityFactor));
            float num2 = (float)((double)FezMath.Dot(instance.TransformedSize, FezMath.SideMask(this.CameraManager.Viewpoint)) / 2.0 + (double)animation.FrameWidth / 32.0 * 2.0 / 3.0);

            if (ActorTypeExtensions.IsBomb(instance.Trile.ActorSettings.Type))
            {
                num2 -= 0.25f;
            }
            opacity = 1f;
            Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint);
            Vector3 vector3_2 = FezMath.ForwardVector(this.CameraManager.Viewpoint);
            bool    b         = (double)this.CollisionManager.GravityFactor < 0.0;

            if (onRight)
            {
                BackgroundPlane backgroundPlane;
                this.LevelManager.AddPlane(backgroundPlane = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, animation)
                {
                    OriginalRotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, (float)FezMath.AsNumeric(b) * 3.141593f),
                    Doublesided      = true,
                    Loop             = false,
                    Opacity          = opacity,
                    Timing           =
                    {
                        Step = 0.0f
                    }
                });
                backgroundPlane.Position  = instance.Center * FezMath.XZMask + vector3_1 * num2 + num1 * Vector3.UnitY - vector3_2;
                backgroundPlane.Billboard = true;
            }
            if (!onLeft)
            {
                return;
            }
            BackgroundPlane backgroundPlane1;

            this.LevelManager.AddPlane(backgroundPlane1 = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, animation)
            {
                OriginalRotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 3.141593f) * Quaternion.CreateFromAxisAngle(Vector3.UnitX, (float)FezMath.AsNumeric(b) * 3.141593f),
                Doublesided      = true,
                Loop             = false,
                Opacity          = opacity,
                Timing           =
                {
                    Step = 0.0f
                }
            });
            backgroundPlane1.Position  = instance.Center * FezMath.XZMask - vector3_1 * num2 + num1 * Vector3.UnitY - vector3_2;
            backgroundPlane1.Billboard = true;
        }