Ejemplo n.º 1
0
        protected override void LoadContent()
        {
            SplitUpCubeHost splitUpCubeHost1 = this;
            Mesh            mesh1            = new Mesh();
            Mesh            mesh2            = mesh1;

            DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
            litTextured1.Specular        = true;
            litTextured1.Emissive        = 0.5f;
            litTextured1.AlphaIsEmissive = true;
            DefaultEffect.LitTextured litTextured2 = litTextured1;
            mesh2.Effect   = (BaseEffect)litTextured2;
            mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending);
            Mesh mesh3 = mesh1;

            splitUpCubeHost1.SolidCubes = mesh3;
            SplitUpCubeHost splitUpCubeHost2 = this;
            Mesh            mesh4            = new Mesh();
            Mesh            mesh5            = mesh4;

            DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored();
            vertexColored1.Fullbright      = true;
            vertexColored1.AlphaIsEmissive = false;
            DefaultEffect.VertexColored vertexColored2 = vertexColored1;
            mesh5.Effect      = (BaseEffect)vertexColored2;
            mesh4.DepthWrites = false;
            Mesh mesh6 = mesh4;

            splitUpCubeHost2.ChimeOutline = mesh6;
            this.ChimeOutline.AddWireframePolygon(Color.Yellow, new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
            this.ChimeOutline.AddWireframePolygon(new Color(Color.Yellow.ToVector3() * 0.3333333f), new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
            this.ChimeOutline.AddWireframePolygon(new Color(Color.Yellow.ToVector3() * 0.1111111f), new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
            this.ChimeOutline.AddWireframePolygon(new Color(Color.Yellow.ToVector3() * 0.03703704f), new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
            this.sBitChime = this.CMProvider.Global.Load <SoundEffect>("Sounds/Collects/BitChime");
        }
Ejemplo n.º 2
0
        private void TryInitialize()
        {
            this.Enabled = this.Visible = this.LevelManager.Name == "TEMPLE_OF_LOVE";
            this.Destroy();
            if (this.Enabled && this.GameState.SaveData.HasDoneHeartReboot)
            {
                foreach (BackgroundPlane plane in Enumerable.ToArray <BackgroundPlane>((IEnumerable <BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values))
                {
                    if (plane.ActorType == ActorType.Waterfall || plane.ActorType == ActorType.Trickle || (plane.TextureName.Contains("water") || plane.TextureName.Contains("fountain")) || plane.AttachedPlane.HasValue)
                    {
                        this.LevelManager.RemovePlane(plane);
                    }
                }
                this.Enabled = this.Visible = false;
            }
            if (!this.Enabled)
            {
                return;
            }
            this.sRayWhiteout = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/RayWhiteout");
            this.WireHeart    = new Mesh()
            {
                Effect = (BaseEffect) new DefaultEffect.VertexColored()
            };
            TempleOfLoveHost templeOfLoveHost = this;
            Mesh             mesh1            = new Mesh();
            Mesh             mesh2            = mesh1;

            DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
            litTextured1.Specular        = true;
            litTextured1.Emissive        = 0.5f;
            litTextured1.AlphaIsEmissive = true;
            DefaultEffect.LitTextured litTextured2 = litTextured1;
            mesh2.Effect = (BaseEffect)litTextured2;
            Mesh mesh3 = mesh1;

            templeOfLoveHost.CrumblingHeart = mesh3;
            Color pink = Color.Pink;

            this.WireHeart.AddGroup().Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <FezVertexPositionColor>(new FezVertexPositionColor[12]
            {
                new FezVertexPositionColor(new Vector3(-1f, -1f, -0.5f), pink),
                new FezVertexPositionColor(new Vector3(-1f, 0.0f, -0.5f), pink),
                new FezVertexPositionColor(new Vector3(0.0f, 0.0f, -0.5f), pink),
                new FezVertexPositionColor(new Vector3(0.0f, 1f, -0.5f), pink),
                new FezVertexPositionColor(new Vector3(1f, 1f, -0.5f), pink),
                new FezVertexPositionColor(new Vector3(1f, -1f, -0.5f), pink),
                new FezVertexPositionColor(new Vector3(-1f, -1f, 0.5f), pink),
                new FezVertexPositionColor(new Vector3(-1f, 0.0f, 0.5f), pink),
                new FezVertexPositionColor(new Vector3(0.0f, 0.0f, 0.5f), pink),
                new FezVertexPositionColor(new Vector3(0.0f, 1f, 0.5f), pink),
                new FezVertexPositionColor(new Vector3(1f, 1f, 0.5f), pink),
                new FezVertexPositionColor(new Vector3(1f, -1f, 0.5f), pink)
            }, new int[36]
            {
                0,
                1,
                1,
                2,
                2,
                3,
                3,
                4,
                4,
                5,
                5,
                0,
                6,
                7,
                7,
                8,
                8,
                9,
                9,
                10,
                10,
                11,
                11,
                6,
                0,
                6,
                1,
                7,
                2,
                8,
                3,
                9,
                4,
                10,
                5,
                11
            }, PrimitiveType.LineList);
            foreach (Vector3 origin in this.PieceOffsets)
            {
                this.WireHeart.AddWireframeBox(Vector3.One, origin, new Color(new Vector4(Color.DeepPink.ToVector3(), 0.125f)), true);
            }
            Trile[] trileArray = new Trile[8]
            {
                this.LevelManager.TrileSet.Triles[244],
                this.LevelManager.TrileSet.Triles[245],
                this.LevelManager.TrileSet.Triles[251],
                this.LevelManager.TrileSet.Triles[246],
                this.LevelManager.TrileSet.Triles[247],
                this.LevelManager.TrileSet.Triles[248],
                this.LevelManager.TrileSet.Triles[249],
                this.LevelManager.TrileSet.Triles[250]
            };
            int num = 0;

            foreach (Vector3 vector3 in this.PieceOffsets)
            {
                foreach (Trile trile in trileArray)
                {
                    Group group = this.CrumblingHeart.AddGroup();
                    group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(Enumerable.ToArray <VertexPositionNormalTextureInstance>((IEnumerable <VertexPositionNormalTextureInstance>)trile.Geometry.Vertices), trile.Geometry.Indices, trile.Geometry.PrimitiveType);
                    group.Position = vector3;
                    group.Enabled  = this.GameState.SaveData.PiecesOfHeart > num;
                    group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, 1.570796f);
                }
                ++num;
            }
            this.CrumblingHeart.Texture = this.LevelMaterializer.TrilesMesh.Texture;
            this.WireHeart.Rotation     = this.CrumblingHeart.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, -0.7853982f);
            this.WireHeart.BakeTransform <FezVertexPositionColor>();
            this.CrumblingHeart.BakeTransform <VertexPositionNormalTextureInstance>();
            foreach (Group group in this.CrumblingHeart.Groups)
            {
                IndexedUserPrimitives <VertexPositionNormalTextureInstance> indexedUserPrimitives = group.Geometry as IndexedUserPrimitives <VertexPositionNormalTextureInstance>;
                Vector3 zero = Vector3.Zero;
                foreach (VertexPositionNormalTextureInstance normalTextureInstance in indexedUserPrimitives.Vertices)
                {
                    zero += normalTextureInstance.Position;
                }
                group.CustomData = (object)(zero / (float)indexedUserPrimitives.Vertices.Length);
            }
            this.RaysMesh = new Mesh()
            {
                Effect      = (BaseEffect) new DefaultEffect.VertexColored(),
                Blending    = new BlendingMode?(BlendingMode.Additive),
                DepthWrites = false
            };
            this.FlareMesh = new Mesh()
            {
                Effect       = (BaseEffect) new DefaultEffect.Textured(),
                Texture      = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/flare_alpha")),
                Blending     = new BlendingMode?(BlendingMode.Alphablending),
                SamplerState = SamplerState.AnisotropicClamp,
                DepthWrites  = false,
                AlwaysOnTop  = true
            };
            this.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true);
            this.WireHeart.Position = this.CrumblingHeart.Position = TempleOfLoveHost.HeartCenter;
        }
Ejemplo n.º 3
0
            public SwooshingCube(TrileInstance instance, Mesh destinationMesh, Vector3 Offset, Quaternion Rotation)
            {
                this.CameraManager     = ServiceHelper.Get <IGameCameraManager>();
                this.LevelManager      = ServiceHelper.Get <ILevelManager>();
                this.LevelMaterializer = ServiceHelper.Get <ILevelMaterializer>();
                this.rotation          = Rotation;
                this.positionOffset    = Offset;
                this.color             = this.StandardTrail;
                switch (this.LevelManager.WaterType)
                {
                case LiquidType.Lava:
                    this.color = this.RedTrail;
                    break;

                case LiquidType.Sewer:
                    this.color = this.SewerTrail;
                    break;
                }
                if (this.LevelManager.BlinkingAlpha)
                {
                    this.color = this.CMYTrail;
                }
                this.Trail = new Mesh()
                {
                    Effect      = (BaseEffect) new DefaultEffect.VertexColored(),
                    Culling     = CullMode.None,
                    Blending    = new BlendingMode?(BlendingMode.Additive),
                    AlwaysOnTop = true
                };
                this.Cube = new Mesh()
                {
                    Texture = this.LevelMaterializer.TrilesMesh.Texture
                };
                if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha)
                {
                    Mesh mesh = this.Cube;
                    DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
                    textured1.AlphaIsEmissive = true;
                    DefaultEffect.Textured textured2 = textured1;
                    mesh.Effect = (BaseEffect)textured2;
                }
                else
                {
                    Mesh mesh = this.Cube;
                    DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
                    litTextured1.Specular        = true;
                    litTextured1.Emissive        = 0.5f;
                    litTextured1.AlphaIsEmissive = true;
                    DefaultEffect.LitTextured litTextured2 = litTextured1;
                    mesh.Effect = (BaseEffect)litTextured2;
                }
                ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry = instance.Trile.Geometry;

                this.Cube.AddGroup().Geometry  = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType);
                this.Trail.AddGroup().Geometry = (IIndexedPrimitiveCollection)(this.TrailGeometry = new IndexedUserPrimitives <FezVertexPositionColor>(this.TrailVertices = new FezVertexPositionColor[0], this.TrailIndices = new int[0], PrimitiveType.TriangleList));
                this.Instance        = instance;
                this.lastPoint       = instance.Center;
                this.DestinationMesh = destinationMesh;
                this.sideDirection   = (RandomHelper.Probability(0.5) ? -1f : 1f) * FezMath.RightVector(this.CameraManager.Viewpoint);
                this.Spline          = new Vector3SplineInterpolation(TimeSpan.FromSeconds(3.0), new Vector3[10]);
                this.Spline.Start();
                this.AddSegment();
            }
Ejemplo n.º 4
0
 private void TryInitialize()
 {
     if (this.WireframeCube == null)
     {
         this.WireframeCube = new Mesh()
         {
             Effect   = (BaseEffect)(this.SplitCollectorEffect = new SplitCollectorEffect()),
             Material =
             {
                 Diffuse = Vector3.One,
                 Opacity = 1f
             },
             Blending = new BlendingMode?(BlendingMode.Alphablending)
         };
         for (int index = 0; index < 7; ++index)
         {
             this.WireframeCube.AddWireframeBox(Vector3.One, Vector3.Zero, new Color(index == 0 ? 1f : (index == 1 ? 0.0f : 0.5f), index == 2 ? 1f : (index == 3 ? 0.0f : 0.5f), index == 4 ? 1f : (index == 5 ? 0.0f : 0.5f), index == 6 ? 1f : 0.0f), true);
             foreach (Vector3 origin in this.CubeOffsets)
             {
                 this.WireframeCube.AddWireframeBox(Vector3.One / 2f, origin, new Color(index == 0 ? 1f : (index == 1 ? 0.0f : 0.5f), index == 2 ? 1f : (index == 3 ? 0.0f : 0.5f), index == 4 ? 1f : (index == 5 ? 0.0f : 0.5f), index == 6 ? 0.625f : 0.375f), true);
             }
         }
         this.WireframeCube.CollapseToBuffer <FezVertexPositionColor>();
     }
     this.SolidCubesVisible = true;
     if (this.TrackedCollects.Count > 0)
     {
         this.GameState.SaveData.CollectedParts += this.TrackedCollects.Count;
         Waiters.Wait(0.5, (Action)(() => Waiters.Wait((Func <bool>)(() =>
         {
             if (this.PlayerManager.CanControl)
             {
                 return(this.PlayerManager.Grounded);
             }
             else
             {
                 return(false);
             }
         }), (Action)(() =>
         {
             this.GomezService.OnCollectedSplitUpCube();
             this.GameState.OnHudElementChanged();
             this.GameState.Save();
             this.TryAssembleCube();
         }))));
     }
     foreach (SplitUpCubeHost.SwooshingCube swooshingCube in this.TrackedCollects)
     {
         swooshingCube.Dispose();
     }
     this.TrackedCollects.Clear();
     if (this.LevelManager.TrileSet == null)
     {
         this.trailsRenderer.Visible = this.Enabled = this.Visible = false;
     }
     else
     {
         Trile goldenCubeTrile = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.GoldenCube));
         IEnumerable <TrileInstance>    source         = Enumerable.Union <TrileInstance>((IEnumerable <TrileInstance>) this.LevelManager.Triles.Values, Enumerable.SelectMany <KeyValuePair <TrileEmplacement, TrileInstance>, TrileInstance>((IEnumerable <KeyValuePair <TrileEmplacement, TrileInstance> >) this.LevelManager.Triles, (Func <KeyValuePair <TrileEmplacement, TrileInstance>, IEnumerable <TrileInstance> >)(x => (IEnumerable <TrileInstance>)x.Value.OverlappedTriles ?? Enumerable.Empty <TrileInstance>())));
         SplitUpCubeHost.TrailsRenderer trailsRenderer = this.trailsRenderer;
         SplitUpCubeHost splitUpCubeHost = this;
         bool            flag1;
         this.Visible = flag1 = goldenCubeTrile != null && (Enumerable.Count <TrileInstance>(source, (Func <TrileInstance, bool>)(x => x.TrileId == goldenCubeTrile.Id)) != 0 || this.AssembleScheduled || this.GameState.SaveData.CollectedParts == 8);
         int  num1;
         bool flag2 = (num1 = flag1 ? 1 : 0) != 0;
         splitUpCubeHost.Enabled = num1 != 0;
         int num2 = flag2 ? 1 : 0;
         trailsRenderer.Visible = num2 != 0;
         if (!this.Enabled)
         {
             return;
         }
         this.RefreshSounds();
         this.TrackedBits.Clear();
         this.TrackedBits.AddRange(Enumerable.Where <TrileInstance>(source, (Func <TrileInstance, bool>)(x => x.TrileId == goldenCubeTrile.Id)));
         this.SolidCubes.ClearGroups();
         ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry = goldenCubeTrile.Geometry;
         this.SolidCubes.Position = Vector3.Zero;
         this.SolidCubes.Rotation = Quaternion.Identity;
         foreach (Vector3 vector3 in this.CubeOffsets)
         {
             Group group = this.SolidCubes.AddGroup();
             group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(Enumerable.ToArray <VertexPositionNormalTextureInstance>((IEnumerable <VertexPositionNormalTextureInstance>)geometry.Vertices), geometry.Indices, geometry.PrimitiveType);
             group.Position = vector3;
             group.BakeTransform <VertexPositionNormalTextureInstance>();
         }
         this.SolidCubes.Texture  = this.LevelMaterializer.TrilesMesh.Texture;
         this.SolidCubes.Rotation = this.WireframeCube.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float)Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f);
         this.WireOpacityFactor   = 1f;
         this.SinceNoTrails       = 3f;
         this.ShineOn             = (TrileInstance)null;
         this.UntilNextShine      = 7f;
         if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha)
         {
             if (this.SolidCubes.Effect is DefaultEffect.LitTextured)
             {
                 Mesh mesh = this.SolidCubes;
                 DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
                 textured1.AlphaIsEmissive = true;
                 textured1.IgnoreCache     = true;
                 DefaultEffect.Textured textured2 = textured1;
                 mesh.Effect = (BaseEffect)textured2;
             }
         }
         else if (this.SolidCubes.Effect is DefaultEffect.Textured)
         {
             Mesh mesh = this.SolidCubes;
             DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
             litTextured1.Specular        = true;
             litTextured1.Emissive        = 0.5f;
             litTextured1.AlphaIsEmissive = true;
             litTextured1.IgnoreCache     = true;
             DefaultEffect.LitTextured litTextured2 = litTextured1;
             mesh.Effect = (BaseEffect)litTextured2;
         }
         this.TryAssembleCube();
     }
 }
Ejemplo n.º 5
0
        private void TryInitialize()
        {
            this.Destroy();
            this.Visible = this.Enabled = this.LevelManager.Name == "HEX_REBUILD";
            if (!this.Enabled)
            {
                return;
            }
            this.GameState.HideHUD = true;
            this.CameraManager.ChangeViewpoint(Viewpoint.Right, 0.0f);
            this.PlayerManager.Background = false;
            ArtObject artObject = this.CMProvider.CurrentLevel.Load <ArtObject>("Art Objects/NEW_HEXAO");
            int       key       = IdentifierPool.FirstAvailable <ArtObjectInstance>(this.LevelManager.ArtObjects);

            this.HexahedronAo = new ArtObjectInstance(artObject)
            {
                Id = key
            };
            this.LevelManager.ArtObjects.Add(key, this.HexahedronAo);
            this.HexahedronAo.Initialize();
            this.HexahedronAo.Hidden = true;
            this.WhiteCube           = new Mesh()
            {
                Effect      = (BaseEffect) new DefaultEffect.VertexColored(),
                Blending    = new BlendingMode?(BlendingMode.Additive),
                DepthWrites = false
            };
            this.WhiteCube.Rotation = this.CameraManager.Rotation * Quaternion.CreateFromRotationMatrix(Matrix.CreateLookAt(Vector3.One, Vector3.Zero, Vector3.Up));
            this.WhiteCube.AddColoredBox(new Vector3(4f), Vector3.Zero, Color.White, true);
            FinalRebuildHost finalRebuildHost = this;
            Mesh             mesh1            = new Mesh();
            Mesh             mesh2            = mesh1;

            DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
            litTextured1.Specular        = true;
            litTextured1.Emissive        = 0.5f;
            litTextured1.AlphaIsEmissive = true;
            DefaultEffect.LitTextured litTextured2 = litTextured1;
            mesh2.Effect   = (BaseEffect)litTextured2;
            mesh1.Blending = new BlendingMode?(BlendingMode.Opaque);
            Mesh mesh3 = mesh1;

            finalRebuildHost.SolidCubes = mesh3;
            this.OriginalCubeRotation   = this.SolidCubes.Rotation = this.WhiteCube.Rotation;
            ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry1 = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.CubeShard)).Geometry;
            ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry2 = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube)).Geometry;

            this.sHexAppear      = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/HexAppear");
            this.sCubeAppear     = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/CubeAppear");
            this.sMotorSpin1     = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/MotorStart1");
            this.sMotorSpin2     = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/MotorStart2");
            this.sMotorSpinAOK   = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/MotorStartAOK");
            this.sMotorSpinCrash = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/MotorStartCrash");
            this.sRayWhiteout    = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/RayWhiteout");
            this.sAku            = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/Aku");
            this.sZoomIn         = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/ZoomIn");
            this.sAmbientDrone   = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Ending/HexRebuild/AmbientDrone");
            for (int index = 0; index < Math.Min(this.GameState.SaveData.CubeShards + this.GameState.SaveData.SecretCubes, 64); ++index)
            {
                Vector3 vector3 = this.CubeOffsets[index];
                ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> indexedPrimitives = index < this.GameState.SaveData.CubeShards ? geometry1 : geometry2;
                Group group = this.SolidCubes.AddGroup();
                group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(Enumerable.ToArray <VertexPositionNormalTextureInstance>((IEnumerable <VertexPositionNormalTextureInstance>)indexedPrimitives.Vertices), indexedPrimitives.Indices, indexedPrimitives.PrimitiveType);
                group.Position = vector3;
                group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, (float)RandomHelper.Random.Next(0, 4) * 1.570796f);
                group.Enabled  = false;
                group.Material = new Material();
            }
            this.SolidCubes.Texture = this.LevelMaterializer.TrilesMesh.Texture;
            this.InvertEffect       = new InvertEffect();
            this.RaysMesh           = new Mesh()
            {
                Effect      = (BaseEffect) new DefaultEffect.VertexColored(),
                Blending    = new BlendingMode?(BlendingMode.Additive),
                DepthWrites = false
            };
            this.FlareMesh = new Mesh()
            {
                Effect       = (BaseEffect) new DefaultEffect.Textured(),
                Texture      = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/flare_alpha")),
                Blending     = new BlendingMode?(BlendingMode.Alphablending),
                SamplerState = SamplerState.AnisotropicClamp,
                DepthWrites  = false,
                AlwaysOnTop  = true
            };
            this.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true);
            this.RtHandle = this.TargetRenderer.TakeTarget();
            this.TargetRenderer.ScheduleHook(this.DrawOrder, this.RtHandle.Target);
            ServiceHelper.AddComponent((IGameComponent)(this.Glitches = new NesGlitches(this.Game)));
        }
Ejemplo n.º 6
0
        protected override void LoadContent()
        {
            TrileSet      trileSet      = this.CMProvider.Global.Load <TrileSet>("Trile Sets/LOADING");
            float         viewAspect    = 1.777778f;
            LoadingScreen loadingScreen = this;
            Mesh          mesh1         = new Mesh();
            Mesh          mesh2         = mesh1;

            DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
            litTextured1.Specular               = true;
            litTextured1.AlphaIsEmissive        = true;
            litTextured1.Emissive               = 0.5f;
            litTextured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f));
            litTextured1.ForcedViewMatrix       = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
            DefaultEffect.LitTextured litTextured2 = litTextured1;
            mesh2.Effect       = (BaseEffect)litTextured2;
            mesh1.Blending     = new BlendingMode?(BlendingMode.Alphablending);
            mesh1.SamplerState = SamplerState.PointClamp;
            mesh1.AlwaysOnTop  = false;
            mesh1.DepthWrites  = true;
            mesh1.Texture      = (Dirtyable <Texture>)((Texture)trileSet.TextureAtlas);
            mesh1.Rotation     = Quaternion.CreateFromAxisAngle(Vector3.Right, (float)Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f);
            mesh1.Position     = new Vector3(5.5f * viewAspect, -4.5f, 0.0f);
            Mesh mesh3 = mesh1;

            loadingScreen.mesh = mesh3;
            Group group = this.mesh.AddGroup();
            ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry = trileSet.Triles[0].Geometry;

            group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(Enumerable.ToArray <VertexPositionNormalTextureInstance>((IEnumerable <VertexPositionNormalTextureInstance>)geometry.Vertices), geometry.Indices, geometry.PrimitiveType);
            group.Scale    = new Vector3(0.95f);
            this.starBack  = this.CMProvider.Global.Load <Texture2D>("Other Textures/hud/starback");
            this.sDrone    = this.CMProvider.Global.Load <SoundEffect>("Sounds/Intro/FezLogoDrone");
            ServiceHelper.AddComponent((IGameComponent)(this.fakeDot = new FakeDot(ServiceHelper.Game)));
            this.LevelManager.LevelChanged += (Action)(() =>
            {
                lock (LoadingScreen.EffectRefreshMutex)
                {
                    if (this.mesh.Effect != null)
                    {
                        this.mesh.Effect.Dispose();
                    }
                    if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha)
                    {
                        Mesh temp_131 = this.mesh;
                        DefaultEffect.Textured temp_135 = new DefaultEffect.Textured()
                        {
                            AlphaIsEmissive = true
                        };
                        temp_131.Effect = (BaseEffect)temp_135;
                    }
                    else
                    {
                        Mesh temp_179 = this.mesh;
                        DefaultEffect.LitTextured temp_187 = new DefaultEffect.LitTextured()
                        {
                            Specular = true,
                            Emissive = 0.5f,
                            AlphaIsEmissive = true
                        };
                        temp_179.Effect = (BaseEffect)temp_187;
                    }
                    this.mesh.Effect.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f));
                    this.mesh.Effect.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
                    this.mesh.TextureMatrix.Dirty = true;
                }
            });
        }