Пример #1
0
        public override void Initialize()
        {
            base.Initialize();
            lock (GlitchyRespawner.StaticLock)
            {
                if (GlitchyRespawner.FullbrightEffect == null)
                {
                    DefaultEffect.Textured local_0 = new DefaultEffect.Textured();
                    local_0.Fullbright = true;
                    GlitchyRespawner.FullbrightEffect = (DefaultEffect)local_0;
                }
                if (GlitchyRespawner.CubemappedEffect == null)
                {
                    GlitchyRespawner.CubemappedEffect = new CubemappedEffect();
                }
            }
            this.SpawnMesh = new Mesh()
            {
                SamplerState = SamplerState.PointClamp,
                DepthWrites  = false,
                Effect       = (BaseEffect)GlitchyRespawner.CubemappedEffect
            };
            ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry = this.Instance.Trile.Geometry;
            IndexedUserPrimitives <VertexPositionNormalTextureInstance> indexedUserPrimitives        = new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType);
            Group group = this.SpawnMesh.AddGroup();

            group.Geometry = (IIndexedPrimitiveCollection)indexedUserPrimitives;
            group.Texture  = (Texture)this.LevelMaterializer.TrilesMesh.Texture;
            if (ActorTypeExtensions.IsPickable(this.Instance.Trile.ActorSettings.Type))
            {
                this.Instance.Phi = (float)FezMath.Round((double)this.Instance.Phi / 1.57079637050629) * 1.570796f;
            }
            group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, this.Instance.Phi);
            if (this.Instance.Trile.ActorSettings.Type == ActorType.CubeShard || this.Instance.Trile.ActorSettings.Type == ActorType.SecretCube || this.Instance.Trile.ActorSettings.Type == ActorType.PieceOfHeart)
            {
                group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Left, (float)Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Down, 0.7853982f) * group.Rotation;
            }
            this.Instance.Foreign = true;
            this.StarsTexture     = this.CMProvider.Global.Load <Texture2D>("Other Textures/black_hole/Stars");
            if (this.EmitOrNot)
            {
                SoundEmitter soundEmitter = SoundEffectExtensions.EmitAt(this.CMProvider.Global.Load <SoundEffect>("Sounds/MiscActors/GlitchyRespawn"), this.Instance.Center);
                soundEmitter.PauseViewTransitions = true;
                soundEmitter.FactorizeVolume      = true;
            }
            this.LightingPostProcess.DrawOnTopLights += new Action(this.DrawLights);
            this.LevelManager.LevelChanging          += new Action(this.Kill);
        }
Пример #2
0
        public override void Initialize()
        {
            base.Initialize();
            this.LogoMesh = new Mesh()
            {
                AlwaysOnTop = true,
                DepthWrites = false,
                Blending    = new BlendingMode?(BlendingMode.Alphablending),
                Effect      = (BaseEffect)(this.FezEffect = (DefaultEffect) new DefaultEffect.VertexColored())
            };
            this.WireMesh = new Mesh()
            {
                DepthWrites = false,
                AlwaysOnTop = true,
                Effect      = this.LogoMesh.Effect
            };
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(0.0f, 0.0f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(0.0f, 1f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(0.0f, 2f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(1f, 2f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(0.0f, 3f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(1f, 3f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(2f, 3f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(0.0f, 0.0f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(1f, 0.0f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(2f, 0.0f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(0.0f, 1f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(0.0f, 2f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(1f, 2f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(0.0f, 3f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(1f, 3f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(2f, 3f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(0.0f, 0.0f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(1f, 0.0f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(2f, 0.0f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(0.0f, 1f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(1f, 1f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(2f, 2f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(0.0f, 3f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(1f, 3f, 0.0f), Color.Black, false);
            this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(2f, 3f, 0.0f), Color.Black, false);
            Group group1 = this.WireMesh.AddGroup();
            IndexedUserPrimitives <FezVertexPositionColor> indexedUserPrimitives1 = new IndexedUserPrimitives <FezVertexPositionColor>(PrimitiveType.LineList);

            group1.Geometry = (IIndexedPrimitiveCollection)indexedUserPrimitives1;
            indexedUserPrimitives1.Vertices = new FezVertexPositionColor[16]
            {
                new FezVertexPositionColor(new Vector3(0.0f, 0.0f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(1f, 0.0f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(1f, 2f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(2f, 2f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(2f, 3f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(3f, 3f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(3f, 4f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(0.0f, 4f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(0.0f, 0.0f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(1f, 0.0f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(1f, 2f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(2f, 2f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(2f, 3f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(3f, 3f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(3f, 4f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(0.0f, 4f, 1f), Color.White)
            };
            indexedUserPrimitives1.Indices = new int[50]
            {
                0,
                1,
                1,
                2,
                2,
                3,
                3,
                4,
                4,
                5,
                5,
                6,
                6,
                7,
                7,
                0,
                8,
                9,
                9,
                10,
                10,
                11,
                11,
                12,
                12,
                13,
                13,
                14,
                14,
                15,
                15,
                8,
                0,
                8,
                1,
                9,
                2,
                10,
                3,
                11,
                4,
                12,
                5,
                13,
                6,
                14,
                7,
                15,
                0,
                8
            };
            Group group2 = this.WireMesh.AddGroup();
            IndexedUserPrimitives <FezVertexPositionColor> indexedUserPrimitives2 = new IndexedUserPrimitives <FezVertexPositionColor>(PrimitiveType.LineList);

            group2.Geometry = (IIndexedPrimitiveCollection)indexedUserPrimitives2;
            indexedUserPrimitives2.Vertices = new FezVertexPositionColor[20]
            {
                new FezVertexPositionColor(new Vector3(4f, 0.0f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(7f, 0.0f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(7f, 1f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(5f, 1f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(5f, 2f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(6f, 2f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(6f, 3f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(7f, 3f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(7f, 4f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(4f, 4f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(4f, 0.0f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(7f, 0.0f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(7f, 1f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(5f, 1f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(5f, 2f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(6f, 2f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(6f, 3f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(7f, 3f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(7f, 4f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(4f, 4f, 1f), Color.White)
            };
            indexedUserPrimitives2.Indices = new int[60]
            {
                0,
                1,
                1,
                2,
                2,
                3,
                3,
                4,
                4,
                5,
                5,
                6,
                6,
                7,
                7,
                8,
                8,
                9,
                9,
                0,
                10,
                11,
                11,
                12,
                12,
                13,
                13,
                14,
                14,
                15,
                15,
                16,
                16,
                17,
                17,
                18,
                18,
                19,
                19,
                10,
                0,
                10,
                1,
                11,
                2,
                12,
                3,
                13,
                4,
                14,
                5,
                15,
                6,
                16,
                7,
                17,
                8,
                18,
                9,
                19
            };
            Group group3 = this.WireMesh.AddGroup();
            IndexedUserPrimitives <FezVertexPositionColor> indexedUserPrimitives3 = new IndexedUserPrimitives <FezVertexPositionColor>(PrimitiveType.LineList);

            group3.Geometry = (IIndexedPrimitiveCollection)indexedUserPrimitives3;
            indexedUserPrimitives3.Vertices = new FezVertexPositionColor[22]
            {
                new FezVertexPositionColor(new Vector3(8f, 0.0f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(11f, 0.0f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(11f, 1f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(10f, 1f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(10f, 2f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(11f, 2f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(11f, 4f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(8f, 4f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(8f, 3f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(10f, 3f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(8f, 2f, 0.0f), Color.White),
                new FezVertexPositionColor(new Vector3(8f, 0.0f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(11f, 0.0f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(11f, 1f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(10f, 1f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(10f, 2f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(11f, 2f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(11f, 4f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(8f, 4f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(8f, 3f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(10f, 3f, 1f), Color.White),
                new FezVertexPositionColor(new Vector3(8f, 2f, 1f), Color.White)
            };
            indexedUserPrimitives3.Indices = new int[70]
            {
                0,
                1,
                1,
                2,
                2,
                3,
                3,
                4,
                4,
                5,
                5,
                6,
                6,
                7,
                7,
                8,
                8,
                9,
                9,
                4,
                4,
                10,
                10,
                0,
                11,
                12,
                12,
                13,
                13,
                14,
                14,
                15,
                15,
                16,
                16,
                17,
                17,
                18,
                18,
                19,
                19,
                20,
                20,
                15,
                15,
                21,
                21,
                11,
                0,
                11,
                1,
                12,
                2,
                13,
                3,
                14,
                4,
                15,
                5,
                16,
                6,
                17,
                7,
                18,
                8,
                19,
                9,
                20,
                10,
                21
            };
            this.WireMesh.Position = this.LogoMesh.Position = new Vector3(-5.5f, -2f, -0.5f);
            this.WireMesh.BakeTransform <FezVertexPositionColor>();
            this.LogoMesh.BakeTransform <FezVertexPositionColor>();
            ContentManager contentManager = this.CMProvider.Get(CM.Menu);

            this.sGlitch1 = contentManager.Load <SoundEffect>("Sounds/Intro/FezLogoGlitch1");
            this.sGlitch2 = contentManager.Load <SoundEffect>("Sounds/Intro/FezLogoGlitch2");
            this.sGlitch3 = contentManager.Load <SoundEffect>("Sounds/Intro/FezLogoGlitch3");
            ServiceHelper.AddComponent((IGameComponent)(this.Starfield = new StarField(this.Game)));
            this.Starfield.Opacity         = 0.0f;
            this.LogoMesh.Material.Opacity = 0.0f;
            this.untilGlitch = RandomHelper.Between(1.0 / 3.0, 1.0);
        }
Пример #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();
 }
Пример #4
0
        protected override IndexedUserPrimitives <T> Read(ContentReader input, IndexedUserPrimitives <T> existingInstance)
        {
            PrimitiveType type = input.ReadObject <PrimitiveType>();

            return(new IndexedUserPrimitives <T>(input.ReadObject <T[]>(), input.ReadObject <int[]>(), type));
        }
Пример #5
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;
        }
Пример #6
0
 public override void Initialize()
 {
   base.Initialize();
   this.Vertices = new List<Vector4>()
   {
     new Vector4(-1f, -1f, -1f, -1f),
     new Vector4(1f, -1f, -1f, -1f),
     new Vector4(-1f, 1f, -1f, -1f),
     new Vector4(1f, 1f, -1f, -1f),
     new Vector4(-1f, -1f, 1f, -1f),
     new Vector4(1f, -1f, 1f, -1f),
     new Vector4(-1f, 1f, 1f, -1f),
     new Vector4(1f, 1f, 1f, -1f),
     new Vector4(-1f, -1f, -1f, 1f),
     new Vector4(1f, -1f, -1f, 1f),
     new Vector4(-1f, 1f, -1f, 1f),
     new Vector4(1f, 1f, -1f, 1f),
     new Vector4(-1f, -1f, 1f, 1f),
     new Vector4(1f, -1f, 1f, 1f),
     new Vector4(-1f, 1f, 1f, 1f),
     new Vector4(1f, 1f, 1f, 1f)
   };
   float aspectRatio = this.GraphicsDevice.Viewport.AspectRatio;
   FakeDot fakeDot1 = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DotEffect dotEffect1 = new DotEffect();
   dotEffect1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio, 14f, 0.1f, 100f));
   dotEffect1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
   DotEffect dotEffect2 = dotEffect1;
   mesh2.Effect = (BaseEffect) dotEffect2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Additive);
   mesh1.DepthWrites = false;
   mesh1.Culling = CullMode.None;
   mesh1.AlwaysOnTop = true;
   mesh1.Material.Opacity = 0.3333333f;
   Mesh mesh3 = mesh1;
   fakeDot1.DotMesh = mesh3;
   FakeDot fakeDot2 = this;
   Mesh mesh4 = new Mesh();
   Mesh mesh5 = mesh4;
   DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
   textured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio, 14f, 0.1f, 100f));
   textured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
   DefaultEffect.Textured textured2 = textured1;
   mesh5.Effect = (BaseEffect) textured2;
   mesh4.Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/smooth_ray"));
   mesh4.Blending = new BlendingMode?(BlendingMode.Additive);
   mesh4.SamplerState = SamplerState.AnisotropicClamp;
   mesh4.DepthWrites = false;
   mesh4.AlwaysOnTop = true;
   Mesh mesh6 = mesh4;
   fakeDot2.RaysMesh = mesh6;
   FakeDot fakeDot3 = this;
   Mesh mesh7 = new Mesh();
   Mesh mesh8 = mesh7;
   DefaultEffect.Textured textured3 = new DefaultEffect.Textured();
   textured3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio, 14f, 0.1f, 100f));
   textured3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
   DefaultEffect.Textured textured4 = textured3;
   mesh8.Effect = (BaseEffect) textured4;
   mesh7.Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/rainbow_flare"));
   mesh7.Blending = new BlendingMode?(BlendingMode.Additive);
   mesh7.SamplerState = SamplerState.AnisotropicClamp;
   mesh7.DepthWrites = false;
   mesh7.AlwaysOnTop = true;
   Mesh mesh9 = mesh7;
   fakeDot3.FlareMesh = mesh9;
   this.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true);
   this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) (this.DotWireGeometry = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.LineList));
   this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) (this.DotFacesGeometry = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.TriangleList));
   this.DotWireGeometry.Vertices = new FezVertexPositionColor[16];
   for (int index = 0; index < 16; ++index)
     this.DotWireGeometry.Vertices[index].Color = new Color(1f, 1f, 1f, 1f);
   this.DotWireGeometry.Indices = new int[64]
   {
     0,
     1,
     0,
     2,
     2,
     3,
     3,
     1,
     4,
     5,
     6,
     7,
     4,
     6,
     5,
     7,
     4,
     0,
     6,
     2,
     3,
     7,
     1,
     5,
     10,
     11,
     8,
     9,
     8,
     10,
     9,
     11,
     12,
     14,
     14,
     15,
     15,
     13,
     12,
     13,
     12,
     8,
     14,
     10,
     15,
     11,
     13,
     9,
     2,
     10,
     3,
     11,
     0,
     8,
     1,
     9,
     6,
     14,
     7,
     15,
     4,
     12,
     5,
     13
   };
   this.DotFacesGeometry.Vertices = new FezVertexPositionColor[96];
   for (int index1 = 0; index1 < 4; ++index1)
   {
     for (int index2 = 0; index2 < 6; ++index2)
     {
       Vector3 vector3 = Vector3.Zero;
       switch ((index2 + index1 * 6) % 6)
       {
         case 0:
           vector3 = new Vector3(0.0f, 1f, 0.75f);
           break;
         case 1:
           vector3 = new Vector3(0.1666667f, 1f, 0.75f);
           break;
         case 2:
           vector3 = new Vector3(0.3333333f, 1f, 0.75f);
           break;
         case 3:
           vector3 = new Vector3(0.5f, 1f, 0.75f);
           break;
         case 4:
           vector3 = new Vector3(0.6666667f, 1f, 0.75f);
           break;
         case 5:
           vector3 = new Vector3(0.8333333f, 1f, 0.75f);
           break;
       }
       for (int index3 = 0; index3 < 4; ++index3)
         this.DotFacesGeometry.Vertices[index3 + index2 * 4 + index1 * 24].Color = new Color(vector3.X, vector3.Y, vector3.Z);
     }
   }
   this.FaceVertexIndices = new int[96]
   {
     0,
     2,
     3,
     1,
     1,
     3,
     7,
     5,
     5,
     7,
     6,
     4,
     4,
     6,
     2,
     0,
     0,
     4,
     5,
     1,
     2,
     6,
     7,
     3,
     8,
     10,
     11,
     9,
     9,
     11,
     15,
     13,
     13,
     15,
     14,
     12,
     12,
     14,
     10,
     8,
     8,
     12,
     13,
     9,
     10,
     14,
     15,
     11,
     0,
     1,
     9,
     8,
     0,
     2,
     10,
     8,
     2,
     3,
     11,
     10,
     3,
     1,
     9,
     11,
     4,
     5,
     13,
     12,
     6,
     7,
     15,
     14,
     4,
     6,
     14,
     12,
     5,
     7,
     15,
     13,
     4,
     0,
     8,
     12,
     6,
     2,
     10,
     14,
     3,
     7,
     15,
     11,
     1,
     5,
     13,
     9
   };
   this.DotFacesGeometry.Indices = new int[144]
   {
     0,
     2,
     1,
     0,
     3,
     2,
     4,
     6,
     5,
     4,
     7,
     6,
     8,
     10,
     9,
     8,
     11,
     10,
     12,
     14,
     13,
     12,
     15,
     14,
     16,
     17,
     18,
     16,
     18,
     19,
     20,
     22,
     21,
     20,
     23,
     22,
     24,
     26,
     25,
     24,
     27,
     26,
     28,
     30,
     29,
     28,
     31,
     30,
     32,
     34,
     33,
     32,
     35,
     34,
     36,
     38,
     37,
     36,
     39,
     38,
     40,
     41,
     42,
     40,
     42,
     43,
     44,
     46,
     45,
     44,
     47,
     46,
     48,
     50,
     49,
     48,
     51,
     50,
     52,
     54,
     53,
     52,
     55,
     54,
     56,
     58,
     57,
     56,
     59,
     58,
     60,
     62,
     61,
     60,
     63,
     62,
     64,
     65,
     66,
     64,
     66,
     67,
     68,
     70,
     69,
     68,
     71,
     70,
     72,
     74,
     73,
     72,
     75,
     74,
     76,
     78,
     77,
     76,
     79,
     78,
     80,
     82,
     81,
     80,
     83,
     82,
     84,
     86,
     85,
     84,
     87,
     86,
     88,
     89,
     90,
     88,
     90,
     91,
     92,
     94,
     93,
     92,
     95,
     94
   };
 }
Пример #7
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();
            }
Пример #8
0
        public override void Initialize()
        {
            base.Initialize();
            lock (TileTransition.Mutex)
            {
                if (TileTransition.sTransition == null)
                {
                    TileTransition.sTransition = this.CMProvider.Global.Load <SoundEffect>("Sounds/Ui/CubeTransition");
                }
            }
            TileTransition tileTransition = this;
            Mesh           mesh1          = new Mesh();
            Mesh           mesh2          = mesh1;

            DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
            textured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(60f), 1f, 0.1f, 100f));
            textured1.ForcedViewMatrix       = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, -1.365f), new Vector3(0.0f, 0.0f, 0.0f), Vector3.Up));
            DefaultEffect.Textured textured2 = textured1;
            mesh2.Effect      = (BaseEffect)textured2;
            mesh1.DepthWrites = false;
            mesh1.AlwaysOnTop = true;
            mesh1.Blending    = new BlendingMode?(BlendingMode.Opaque);
            Mesh mesh3 = mesh1;

            tileTransition.mesh = mesh3;
            for (int index1 = 0; index1 < 1; ++index1)
            {
                for (int index2 = 0; index2 < 1; ++index2)
                {
                    float x      = (float)index1 / 1f;
                    float num1   = (float)(index1 + 1) / 1f;
                    float y      = (float)index2 / 1f;
                    float num2   = (float)(index2 + 1) / 1f;
                    bool  flag1  = RandomHelper.Probability(0.5);
                    bool  flag2  = RandomHelper.Probability(0.5);
                    Group group1 = this.mesh.AddGroup();
                    if (flag2)
                    {
                        group1.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionTexture>(new VertexPositionTexture[4]
                        {
                            new VertexPositionTexture(new Vector3(-0.5f, 0.5f, -0.5f), new Vector2(1f - x, 1f - num2)),
                            new VertexPositionTexture(new Vector3(0.5f, 0.5f, -0.5f), new Vector2(1f - num1, 1f - num2)),
                            new VertexPositionTexture(new Vector3(-0.5f, -0.5f, -0.5f), new Vector2(1f - x, 1f - y)),
                            new VertexPositionTexture(new Vector3(0.5f, -0.5f, -0.5f), new Vector2(1f - num1, 1f - y))
                        }, new int[6]
                        {
                            0,
                            2,
                            1,
                            2,
                            3,
                            1
                        }, PrimitiveType.TriangleList);
                    }
                    else
                    {
                        group1.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionTexture>(new VertexPositionTexture[4]
                        {
                            new VertexPositionTexture(new Vector3(-0.5f, 0.5f, -0.5f), new Vector2(1f - x, 1f - num2)),
                            new VertexPositionTexture(new Vector3(0.5f, 0.5f, -0.5f), new Vector2(1f - num1, 1f - num2)),
                            new VertexPositionTexture(new Vector3(-0.5f, -0.5f, -0.5f), new Vector2(1f - x, 1f - y)),
                            new VertexPositionTexture(new Vector3(0.5f, -0.5f, -0.5f), new Vector2(1f - num1, 1f - y))
                        }, new int[6]
                        {
                            0,
                            2,
                            1,
                            2,
                            3,
                            1
                        }, PrimitiveType.TriangleList);
                    }
                    group1.Scale      = new Vector3(1f, 1f, (float)(1.0 / (flag2 ? 1.0 : 1.0)));
                    group1.Position   = new Vector3(x, y, 0.0f);
                    group1.CustomData = (object)new TileTransition.TileData()
                    {
                        X        = (x + RandomHelper.Centered(0.150000005960464)),
                        Y        = (y + RandomHelper.Centered(0.150000005960464)),
                        B        = false,
                        Inverted = flag1,
                        Vertical = flag2
                    };
                    group1.Material = new Material();
                    Group group2 = this.mesh.AddGroup();
                    if (flag2)
                    {
                        Group group3 = group2;
                        VertexPositionTexture[] vertices = new VertexPositionTexture[4]
                        {
                            new VertexPositionTexture(new Vector3(-0.5f, flag1 ? 0.5f : -0.5f, -0.5f), new Vector2(1f - x, flag1 ? 1f - y : 1f - num2)),
                            new VertexPositionTexture(new Vector3(0.5f, flag1 ? 0.5f : -0.5f, -0.5f), new Vector2(1f - num1, flag1 ? 1f - y : 1f - num2)),
                            new VertexPositionTexture(new Vector3(-0.5f, flag1 ? 0.5f : -0.5f, 0.5f), new Vector2(1f - x, flag1 ? 1f - num2 : 1f - y)),
                            new VertexPositionTexture(new Vector3(0.5f, flag1 ? 0.5f : -0.5f, 0.5f), new Vector2(1f - num1, flag1 ? 1f - num2 : 1f - y))
                        };
                        int[] indices;
                        if (!flag1)
                        {
                            indices = new int[6]
                            {
                                0,
                                2,
                                1,
                                2,
                                3,
                                1
                            }
                        }
                        ;
                        else
                        {
                            indices = new int[6]
                            {
                                0,
                                1,
                                2,
                                2,
                                1,
                                3
                            }
                        };
                        int num3 = 0;
                        IndexedUserPrimitives <VertexPositionTexture> indexedUserPrimitives = new IndexedUserPrimitives <VertexPositionTexture>(vertices, indices, (PrimitiveType)num3);
                        group3.Geometry = (IIndexedPrimitiveCollection)indexedUserPrimitives;
                    }
                    else
                    {
                        Group group3 = group2;
                        VertexPositionTexture[] vertices = new VertexPositionTexture[4]
                        {
                            new VertexPositionTexture(new Vector3(flag1 ? 0.5f : -0.5f, 0.5f, 0.5f), new Vector2(flag1 ? 1f - num1 : 1f - x, 1f - num2)),
                            new VertexPositionTexture(new Vector3(flag1 ? 0.5f : -0.5f, 0.5f, -0.5f), new Vector2(flag1 ? 1f - x : 1f - num1, 1f - num2)),
                            new VertexPositionTexture(new Vector3(flag1 ? 0.5f : -0.5f, -0.5f, 0.5f), new Vector2(flag1 ? 1f - num1 : 1f - x, 1f - y)),
                            new VertexPositionTexture(new Vector3(flag1 ? 0.5f : -0.5f, -0.5f, -0.5f), new Vector2(flag1 ? 1f - x : 1f - num1, 1f - y))
                        };
                        int[] indices;
                        if (!flag1)
                        {
                            indices = new int[6]
                            {
                                0,
                                2,
                                1,
                                2,
                                3,
                                1
                            }
                        }
                        ;
                        else
                        {
                            indices = new int[6]
                            {
                                0,
                                1,
                                2,
                                2,
                                1,
                                3
                            }
                        };
                        int num3 = 0;
                        IndexedUserPrimitives <VertexPositionTexture> indexedUserPrimitives = new IndexedUserPrimitives <VertexPositionTexture>(vertices, indices, (PrimitiveType)num3);
                        group3.Geometry = (IIndexedPrimitiveCollection)indexedUserPrimitives;
                    }
                    group2.Scale      = new Vector3(1f, 1f, (float)(1.0 / (flag2 ? 1.0 : 1.0)));
                    group2.Position   = new Vector3(x, y, 0.0f);
                    group2.CustomData = (object)new TileTransition.TileData()
                    {
                        X        = (x + RandomHelper.Centered(0.150000005960464)),
                        Y        = (y + RandomHelper.Centered(0.150000005960464)),
                        B        = true,
                        Inverted = flag1,
                        Vertical = flag2
                    };
                    group2.Material = new Material();
                }
            }
            this.mesh.Position = new Vector3(0.0f, 0.0f, 0.0f);
            this.textureA      = this.TargetRenderer.TakeTarget();
            this.textureB      = this.TargetRenderer.TakeTarget();
            foreach (Group group in this.mesh.Groups)
            {
                group.Texture = !((TileTransition.TileData)group.CustomData).B ? (Texture)this.textureA.Target : (Texture)this.textureB.Target;
            }
            this.TargetRenderer.ScheduleHook(this.DrawOrder, this.textureA.Target);
            SoundEffectExtensions.Emit(TileTransition.sTransition);
        }
Пример #9
0
 public override void Initialize()
 {
   base.Initialize();
   lock (TileTransition.Mutex)
   {
     if (TileTransition.sTransition == null)
       TileTransition.sTransition = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/CubeTransition");
   }
   TileTransition tileTransition = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
   textured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(60f), 1f, 0.1f, 100f));
   textured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, -1.365f), new Vector3(0.0f, 0.0f, 0.0f), Vector3.Up));
   DefaultEffect.Textured textured2 = textured1;
   mesh2.Effect = (BaseEffect) textured2;
   mesh1.DepthWrites = false;
   mesh1.AlwaysOnTop = true;
   mesh1.Blending = new BlendingMode?(BlendingMode.Opaque);
   Mesh mesh3 = mesh1;
   tileTransition.mesh = mesh3;
   for (int index1 = 0; index1 < 1; ++index1)
   {
     for (int index2 = 0; index2 < 1; ++index2)
     {
       float x = (float) index1 / 1f;
       float num1 = (float) (index1 + 1) / 1f;
       float y = (float) index2 / 1f;
       float num2 = (float) (index2 + 1) / 1f;
       bool flag1 = RandomHelper.Probability(0.5);
       bool flag2 = RandomHelper.Probability(0.5);
       Group group1 = this.mesh.AddGroup();
       if (flag2)
         group1.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionTexture>(new VertexPositionTexture[4]
         {
           new VertexPositionTexture(new Vector3(-0.5f, 0.5f, -0.5f), new Vector2(1f - x, 1f - num2)),
           new VertexPositionTexture(new Vector3(0.5f, 0.5f, -0.5f), new Vector2(1f - num1, 1f - num2)),
           new VertexPositionTexture(new Vector3(-0.5f, -0.5f, -0.5f), new Vector2(1f - x, 1f - y)),
           new VertexPositionTexture(new Vector3(0.5f, -0.5f, -0.5f), new Vector2(1f - num1, 1f - y))
         }, new int[6]
         {
           0,
           2,
           1,
           2,
           3,
           1
         }, PrimitiveType.TriangleList);
       else
         group1.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionTexture>(new VertexPositionTexture[4]
         {
           new VertexPositionTexture(new Vector3(-0.5f, 0.5f, -0.5f), new Vector2(1f - x, 1f - num2)),
           new VertexPositionTexture(new Vector3(0.5f, 0.5f, -0.5f), new Vector2(1f - num1, 1f - num2)),
           new VertexPositionTexture(new Vector3(-0.5f, -0.5f, -0.5f), new Vector2(1f - x, 1f - y)),
           new VertexPositionTexture(new Vector3(0.5f, -0.5f, -0.5f), new Vector2(1f - num1, 1f - y))
         }, new int[6]
         {
           0,
           2,
           1,
           2,
           3,
           1
         }, PrimitiveType.TriangleList);
       group1.Scale = new Vector3(1f, 1f, (float) (1.0 / (flag2 ? 1.0 : 1.0)));
       group1.Position = new Vector3(x, y, 0.0f);
       group1.CustomData = (object) new TileTransition.TileData()
       {
         X = (x + RandomHelper.Centered(0.150000005960464)),
         Y = (y + RandomHelper.Centered(0.150000005960464)),
         B = false,
         Inverted = flag1,
         Vertical = flag2
       };
       group1.Material = new Material();
       Group group2 = this.mesh.AddGroup();
       if (flag2)
       {
         Group group3 = group2;
         VertexPositionTexture[] vertices = new VertexPositionTexture[4]
         {
           new VertexPositionTexture(new Vector3(-0.5f, flag1 ? 0.5f : -0.5f, -0.5f), new Vector2(1f - x, flag1 ? 1f - y : 1f - num2)),
           new VertexPositionTexture(new Vector3(0.5f, flag1 ? 0.5f : -0.5f, -0.5f), new Vector2(1f - num1, flag1 ? 1f - y : 1f - num2)),
           new VertexPositionTexture(new Vector3(-0.5f, flag1 ? 0.5f : -0.5f, 0.5f), new Vector2(1f - x, flag1 ? 1f - num2 : 1f - y)),
           new VertexPositionTexture(new Vector3(0.5f, flag1 ? 0.5f : -0.5f, 0.5f), new Vector2(1f - num1, flag1 ? 1f - num2 : 1f - y))
         };
         int[] indices;
         if (!flag1)
           indices = new int[6]
           {
             0,
             2,
             1,
             2,
             3,
             1
           };
         else
           indices = new int[6]
           {
             0,
             1,
             2,
             2,
             1,
             3
           };
         int num3 = 0;
         IndexedUserPrimitives<VertexPositionTexture> indexedUserPrimitives = new IndexedUserPrimitives<VertexPositionTexture>(vertices, indices, (PrimitiveType) num3);
         group3.Geometry = (IIndexedPrimitiveCollection) indexedUserPrimitives;
       }
       else
       {
         Group group3 = group2;
         VertexPositionTexture[] vertices = new VertexPositionTexture[4]
         {
           new VertexPositionTexture(new Vector3(flag1 ? 0.5f : -0.5f, 0.5f, 0.5f), new Vector2(flag1 ? 1f - num1 : 1f - x, 1f - num2)),
           new VertexPositionTexture(new Vector3(flag1 ? 0.5f : -0.5f, 0.5f, -0.5f), new Vector2(flag1 ? 1f - x : 1f - num1, 1f - num2)),
           new VertexPositionTexture(new Vector3(flag1 ? 0.5f : -0.5f, -0.5f, 0.5f), new Vector2(flag1 ? 1f - num1 : 1f - x, 1f - y)),
           new VertexPositionTexture(new Vector3(flag1 ? 0.5f : -0.5f, -0.5f, -0.5f), new Vector2(flag1 ? 1f - x : 1f - num1, 1f - y))
         };
         int[] indices;
         if (!flag1)
           indices = new int[6]
           {
             0,
             2,
             1,
             2,
             3,
             1
           };
         else
           indices = new int[6]
           {
             0,
             1,
             2,
             2,
             1,
             3
           };
         int num3 = 0;
         IndexedUserPrimitives<VertexPositionTexture> indexedUserPrimitives = new IndexedUserPrimitives<VertexPositionTexture>(vertices, indices, (PrimitiveType) num3);
         group3.Geometry = (IIndexedPrimitiveCollection) indexedUserPrimitives;
       }
       group2.Scale = new Vector3(1f, 1f, (float) (1.0 / (flag2 ? 1.0 : 1.0)));
       group2.Position = new Vector3(x, y, 0.0f);
       group2.CustomData = (object) new TileTransition.TileData()
       {
         X = (x + RandomHelper.Centered(0.150000005960464)),
         Y = (y + RandomHelper.Centered(0.150000005960464)),
         B = true,
         Inverted = flag1,
         Vertical = flag2
       };
       group2.Material = new Material();
     }
   }
   this.mesh.Position = new Vector3(0.0f, 0.0f, 0.0f);
   this.textureA = this.TargetRenderer.TakeTarget();
   this.textureB = this.TargetRenderer.TakeTarget();
   foreach (Group group in this.mesh.Groups)
     group.Texture = !((TileTransition.TileData) group.CustomData).B ? (Texture) this.textureA.Target : (Texture) this.textureB.Target;
   this.TargetRenderer.ScheduleHook(this.DrawOrder, this.textureA.Target);
   SoundEffectExtensions.Emit(TileTransition.sTransition);
 }
Пример #10
0
 public override void Initialize()
 {
   base.Initialize();
   lock (GlitchyRespawner.StaticLock)
   {
     if (GlitchyRespawner.FullbrightEffect == null)
     {
       DefaultEffect.Textured local_0 = new DefaultEffect.Textured();
       local_0.Fullbright = true;
       GlitchyRespawner.FullbrightEffect = (DefaultEffect) local_0;
     }
     if (GlitchyRespawner.CubemappedEffect == null)
       GlitchyRespawner.CubemappedEffect = new CubemappedEffect();
   }
   this.SpawnMesh = new Mesh()
   {
     SamplerState = SamplerState.PointClamp,
     DepthWrites = false,
     Effect = (BaseEffect) GlitchyRespawner.CubemappedEffect
   };
   ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry = this.Instance.Trile.Geometry;
   IndexedUserPrimitives<VertexPositionNormalTextureInstance> indexedUserPrimitives = new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType);
   Group group = this.SpawnMesh.AddGroup();
   group.Geometry = (IIndexedPrimitiveCollection) indexedUserPrimitives;
   group.Texture = (Texture) this.LevelMaterializer.TrilesMesh.Texture;
   if (ActorTypeExtensions.IsPickable(this.Instance.Trile.ActorSettings.Type))
     this.Instance.Phi = (float) FezMath.Round((double) this.Instance.Phi / 1.57079637050629) * 1.570796f;
   group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, this.Instance.Phi);
   if (this.Instance.Trile.ActorSettings.Type == ActorType.CubeShard || this.Instance.Trile.ActorSettings.Type == ActorType.SecretCube || this.Instance.Trile.ActorSettings.Type == ActorType.PieceOfHeart)
     group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Left, (float) Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Down, 0.7853982f) * group.Rotation;
   this.Instance.Foreign = true;
   this.StarsTexture = this.CMProvider.Global.Load<Texture2D>("Other Textures/black_hole/Stars");
   if (this.EmitOrNot)
   {
     SoundEmitter soundEmitter = SoundEffectExtensions.EmitAt(this.CMProvider.Global.Load<SoundEffect>("Sounds/MiscActors/GlitchyRespawn"), this.Instance.Center);
     soundEmitter.PauseViewTransitions = true;
     soundEmitter.FactorizeVolume = true;
   }
   this.LightingPostProcess.DrawOnTopLights += new Action(this.DrawLights);
   this.LevelManager.LevelChanging += new Action(this.Kill);
 }
Пример #11
0
        public override void Initialize()
        {
            base.Initialize();
            this.Vertices = new List <Vector4>()
            {
                new Vector4(-1f, -1f, -1f, -1f),
                new Vector4(1f, -1f, -1f, -1f),
                new Vector4(-1f, 1f, -1f, -1f),
                new Vector4(1f, 1f, -1f, -1f),
                new Vector4(-1f, -1f, 1f, -1f),
                new Vector4(1f, -1f, 1f, -1f),
                new Vector4(-1f, 1f, 1f, -1f),
                new Vector4(1f, 1f, 1f, -1f),
                new Vector4(-1f, -1f, -1f, 1f),
                new Vector4(1f, -1f, -1f, 1f),
                new Vector4(-1f, 1f, -1f, 1f),
                new Vector4(1f, 1f, -1f, 1f),
                new Vector4(-1f, -1f, 1f, 1f),
                new Vector4(1f, -1f, 1f, 1f),
                new Vector4(-1f, 1f, 1f, 1f),
                new Vector4(1f, 1f, 1f, 1f)
            };
            float     aspectRatio = this.GraphicsDevice.Viewport.AspectRatio;
            FakeDot   fakeDot1    = this;
            Mesh      mesh1       = new Mesh();
            Mesh      mesh2       = mesh1;
            DotEffect dotEffect1  = new DotEffect();

            dotEffect1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio, 14f, 0.1f, 100f));
            dotEffect1.ForcedViewMatrix       = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
            DotEffect dotEffect2 = dotEffect1;

            mesh2.Effect           = (BaseEffect)dotEffect2;
            mesh1.Blending         = new BlendingMode?(BlendingMode.Additive);
            mesh1.DepthWrites      = false;
            mesh1.Culling          = CullMode.None;
            mesh1.AlwaysOnTop      = true;
            mesh1.Material.Opacity = 0.3333333f;
            Mesh mesh3 = mesh1;

            fakeDot1.DotMesh = mesh3;
            FakeDot fakeDot2 = this;
            Mesh    mesh4    = new Mesh();
            Mesh    mesh5    = mesh4;

            DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
            textured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio, 14f, 0.1f, 100f));
            textured1.ForcedViewMatrix       = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
            DefaultEffect.Textured textured2 = textured1;
            mesh5.Effect       = (BaseEffect)textured2;
            mesh4.Texture      = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/smooth_ray"));
            mesh4.Blending     = new BlendingMode?(BlendingMode.Additive);
            mesh4.SamplerState = SamplerState.AnisotropicClamp;
            mesh4.DepthWrites  = false;
            mesh4.AlwaysOnTop  = true;
            Mesh mesh6 = mesh4;

            fakeDot2.RaysMesh = mesh6;
            FakeDot fakeDot3 = this;
            Mesh    mesh7    = new Mesh();
            Mesh    mesh8    = mesh7;

            DefaultEffect.Textured textured3 = new DefaultEffect.Textured();
            textured3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio, 14f, 0.1f, 100f));
            textured3.ForcedViewMatrix       = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
            DefaultEffect.Textured textured4 = textured3;
            mesh8.Effect       = (BaseEffect)textured4;
            mesh7.Texture      = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/rainbow_flare"));
            mesh7.Blending     = new BlendingMode?(BlendingMode.Additive);
            mesh7.SamplerState = SamplerState.AnisotropicClamp;
            mesh7.DepthWrites  = false;
            mesh7.AlwaysOnTop  = true;
            Mesh mesh9 = mesh7;

            fakeDot3.FlareMesh = mesh9;
            this.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true);
            this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection)(this.DotWireGeometry = new IndexedUserPrimitives <FezVertexPositionColor>(PrimitiveType.LineList));
            this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection)(this.DotFacesGeometry = new IndexedUserPrimitives <FezVertexPositionColor>(PrimitiveType.TriangleList));
            this.DotWireGeometry.Vertices    = new FezVertexPositionColor[16];
            for (int index = 0; index < 16; ++index)
            {
                this.DotWireGeometry.Vertices[index].Color = new Color(1f, 1f, 1f, 1f);
            }
            this.DotWireGeometry.Indices = new int[64]
            {
                0,
                1,
                0,
                2,
                2,
                3,
                3,
                1,
                4,
                5,
                6,
                7,
                4,
                6,
                5,
                7,
                4,
                0,
                6,
                2,
                3,
                7,
                1,
                5,
                10,
                11,
                8,
                9,
                8,
                10,
                9,
                11,
                12,
                14,
                14,
                15,
                15,
                13,
                12,
                13,
                12,
                8,
                14,
                10,
                15,
                11,
                13,
                9,
                2,
                10,
                3,
                11,
                0,
                8,
                1,
                9,
                6,
                14,
                7,
                15,
                4,
                12,
                5,
                13
            };
            this.DotFacesGeometry.Vertices = new FezVertexPositionColor[96];
            for (int index1 = 0; index1 < 4; ++index1)
            {
                for (int index2 = 0; index2 < 6; ++index2)
                {
                    Vector3 vector3 = Vector3.Zero;
                    switch ((index2 + index1 * 6) % 6)
                    {
                    case 0:
                        vector3 = new Vector3(0.0f, 1f, 0.75f);
                        break;

                    case 1:
                        vector3 = new Vector3(0.1666667f, 1f, 0.75f);
                        break;

                    case 2:
                        vector3 = new Vector3(0.3333333f, 1f, 0.75f);
                        break;

                    case 3:
                        vector3 = new Vector3(0.5f, 1f, 0.75f);
                        break;

                    case 4:
                        vector3 = new Vector3(0.6666667f, 1f, 0.75f);
                        break;

                    case 5:
                        vector3 = new Vector3(0.8333333f, 1f, 0.75f);
                        break;
                    }
                    for (int index3 = 0; index3 < 4; ++index3)
                    {
                        this.DotFacesGeometry.Vertices[index3 + index2 * 4 + index1 * 24].Color = new Color(vector3.X, vector3.Y, vector3.Z);
                    }
                }
            }
            this.FaceVertexIndices = new int[96]
            {
                0,
                2,
                3,
                1,
                1,
                3,
                7,
                5,
                5,
                7,
                6,
                4,
                4,
                6,
                2,
                0,
                0,
                4,
                5,
                1,
                2,
                6,
                7,
                3,
                8,
                10,
                11,
                9,
                9,
                11,
                15,
                13,
                13,
                15,
                14,
                12,
                12,
                14,
                10,
                8,
                8,
                12,
                13,
                9,
                10,
                14,
                15,
                11,
                0,
                1,
                9,
                8,
                0,
                2,
                10,
                8,
                2,
                3,
                11,
                10,
                3,
                1,
                9,
                11,
                4,
                5,
                13,
                12,
                6,
                7,
                15,
                14,
                4,
                6,
                14,
                12,
                5,
                7,
                15,
                13,
                4,
                0,
                8,
                12,
                6,
                2,
                10,
                14,
                3,
                7,
                15,
                11,
                1,
                5,
                13,
                9
            };
            this.DotFacesGeometry.Indices = new int[144]
            {
                0,
                2,
                1,
                0,
                3,
                2,
                4,
                6,
                5,
                4,
                7,
                6,
                8,
                10,
                9,
                8,
                11,
                10,
                12,
                14,
                13,
                12,
                15,
                14,
                16,
                17,
                18,
                16,
                18,
                19,
                20,
                22,
                21,
                20,
                23,
                22,
                24,
                26,
                25,
                24,
                27,
                26,
                28,
                30,
                29,
                28,
                31,
                30,
                32,
                34,
                33,
                32,
                35,
                34,
                36,
                38,
                37,
                36,
                39,
                38,
                40,
                41,
                42,
                40,
                42,
                43,
                44,
                46,
                45,
                44,
                47,
                46,
                48,
                50,
                49,
                48,
                51,
                50,
                52,
                54,
                53,
                52,
                55,
                54,
                56,
                58,
                57,
                56,
                59,
                58,
                60,
                62,
                61,
                60,
                63,
                62,
                64,
                65,
                66,
                64,
                66,
                67,
                68,
                70,
                69,
                68,
                71,
                70,
                72,
                74,
                73,
                72,
                75,
                74,
                76,
                78,
                77,
                76,
                79,
                78,
                80,
                82,
                81,
                80,
                83,
                82,
                84,
                86,
                85,
                84,
                87,
                86,
                88,
                89,
                90,
                88,
                90,
                91,
                92,
                94,
                93,
                92,
                95,
                94
            };
        }
Пример #12
0
            private void BuildMesh()
            {
                Vector3 a     = (this.Volume.To - this.Volume.From) / 2f;
                float   num1  = a.Y * 2f;
                Mesh    mesh1 = new Mesh();
                Mesh    mesh2 = new Mesh();

                FaceOrientation[] faceOrientationArray = new FaceOrientation[4]
                {
                    FaceOrientation.Front,
                    FaceOrientation.Right,
                    FaceOrientation.Back,
                    FaceOrientation.Left
                };
                foreach (FaceOrientation faceOrientation in faceOrientationArray)
                {
                    Vector3 vector3_1 = FezMath.AsVector(FezMath.IsSide(FezMath.GetTangent(faceOrientation)) ? FezMath.GetTangent(faceOrientation) : FezMath.GetBitangent(faceOrientation));
                    Vector3 origin    = this.Center + FezMath.AsVector(faceOrientation) * a;
                    float   num2      = Math.Abs(FezMath.Dot(a, vector3_1)) * 2f;
                    Vector3 vector3_2 = origin + (a - new Vector3(0.5f)) * (-vector3_1 - Vector3.UnitY);
                    Vector3 vector3_3 = origin + (a - new Vector3(0.5f)) * (-vector3_1 + Vector3.UnitY);
                    for (int index = 0; (double)index < (double)num2; ++index)
                    {
                        Vector3 p = vector3_2 + (float)index * vector3_1;
                        if (!Enumerable.Any <Group>((IEnumerable <Group>)mesh1.Groups, (Func <Group, bool>)(g => FezMath.AlmostEqual(g.Position, p))))
                        {
                            mesh1.AddFace(Vector3.One * 2f, Vector3.Zero, faceOrientation, true).Position = p;
                        }
                        p = vector3_3 + (float)index * vector3_1;
                        if (!Enumerable.Any <Group>((IEnumerable <Group>)mesh1.Groups, (Func <Group, bool>)(g => FezMath.AlmostEqual(g.Position, p))))
                        {
                            mesh1.AddFace(Vector3.One * 2f, Vector3.Zero, faceOrientation, true).Position = p;
                        }
                    }
                    Vector3 vector3_4 = origin + (a - new Vector3(0.5f)) * (-vector3_1 - Vector3.UnitY);
                    Vector3 vector3_5 = origin + (a - new Vector3(0.5f)) * (vector3_1 - Vector3.UnitY);
                    for (int index = 0; (double)index < (double)num1; ++index)
                    {
                        Vector3 p = vector3_4 + (float)index * Vector3.UnitY;
                        if (!Enumerable.Any <Group>((IEnumerable <Group>)mesh1.Groups, (Func <Group, bool>)(g => FezMath.AlmostEqual(g.Position, p))))
                        {
                            mesh1.AddFace(Vector3.One * 2f, Vector3.Zero, faceOrientation, true).Position = p;
                        }
                        p = vector3_5 + (float)index * Vector3.UnitY;
                        if (!Enumerable.Any <Group>((IEnumerable <Group>)mesh1.Groups, (Func <Group, bool>)(g => FezMath.AlmostEqual(g.Position, p))))
                        {
                            mesh1.AddFace(Vector3.One * 2f, Vector3.Zero, faceOrientation, true).Position = p;
                        }
                    }
                    mesh2.AddFace(num2 * FezMath.Abs(vector3_1) + num1 * Vector3.UnitY, origin, faceOrientation, Color.White, true);
                }
                foreach (Group group in mesh1.Groups)
                {
                    group.TextureMatrix = (Dirtyable <Matrix?>) new Matrix?(new Matrix(0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.5 > this.Host.random.NextDouble() ? 0.5f : 0.0f, 0.5 > this.Host.random.NextDouble() ? 0.5f : 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f));
                }
                mesh2.Collapse <VertexPositionNormalColor>();
                IndexedUserPrimitives <VertexPositionNormalColor> indexedUserPrimitives1 = mesh2.FirstGroup.Geometry as IndexedUserPrimitives <VertexPositionNormalColor>;

                mesh1.CollapseWithNormalTexture <FezVertexPositionNormalTexture>();
                IndexedUserPrimitives <FezVertexPositionNormalTexture> indexedUserPrimitives2 = mesh1.FirstGroup.Geometry as IndexedUserPrimitives <FezVertexPositionNormalTexture>;

                this.instanceIndex = this.Host.HolesBodyMesh.Groups.Count;
                this.Host.HolesBodyMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionInstance>(Enumerable.ToArray <VertexPositionInstance>(Enumerable.Select <VertexPositionNormalColor, VertexPositionInstance>((IEnumerable <VertexPositionNormalColor>)indexedUserPrimitives1.Vertices, (Func <VertexPositionNormalColor, VertexPositionInstance>)(x => new VertexPositionInstance(x.Position)
                {
                    InstanceIndex = (float)this.instanceIndex
                }))), indexedUserPrimitives1.Indices, PrimitiveType.TriangleList);
                this.Host.HolesFringeMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionTextureInstance>(Enumerable.ToArray <VertexPositionTextureInstance>(Enumerable.Select <FezVertexPositionNormalTexture, VertexPositionTextureInstance>((IEnumerable <FezVertexPositionNormalTexture>)indexedUserPrimitives2.Vertices, (Func <FezVertexPositionNormalTexture, VertexPositionTextureInstance>)(x => new VertexPositionTextureInstance(x.Position, x.TextureCoordinate)
                {
                    InstanceIndex = (float)this.instanceIndex
                }))), indexedUserPrimitives2.Indices, PrimitiveType.TriangleList);
            }
Пример #13
0
 public override void Initialize()
 {
   base.Initialize();
   this.LogoMesh = new Mesh()
   {
     AlwaysOnTop = true,
     DepthWrites = false,
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     Effect = (BaseEffect) (this.FezEffect = (DefaultEffect) new DefaultEffect.VertexColored())
   };
   this.WireMesh = new Mesh()
   {
     DepthWrites = false,
     AlwaysOnTop = true,
     Effect = this.LogoMesh.Effect
   };
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(0.0f, 0.0f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(0.0f, 1f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(0.0f, 2f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(1f, 2f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(0.0f, 3f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(1f, 3f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(2f, 3f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(0.0f, 0.0f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(1f, 0.0f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(2f, 0.0f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(0.0f, 1f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(0.0f, 2f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(1f, 2f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(0.0f, 3f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(1f, 3f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(4f, 0.0f, 0.0f) + new Vector3(2f, 3f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(0.0f, 0.0f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(1f, 0.0f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(2f, 0.0f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(0.0f, 1f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(1f, 1f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(2f, 2f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(0.0f, 3f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(1f, 3f, 0.0f), Color.Black, false);
   this.LogoMesh.AddColoredBox(Vector3.One, new Vector3(8f, 0.0f, 0.0f) + new Vector3(2f, 3f, 0.0f), Color.Black, false);
   Group group1 = this.WireMesh.AddGroup();
   IndexedUserPrimitives<FezVertexPositionColor> indexedUserPrimitives1 = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.LineList);
   group1.Geometry = (IIndexedPrimitiveCollection) indexedUserPrimitives1;
   indexedUserPrimitives1.Vertices = new FezVertexPositionColor[16]
   {
     new FezVertexPositionColor(new Vector3(0.0f, 0.0f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(1f, 0.0f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(1f, 2f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(2f, 2f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(2f, 3f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(3f, 3f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(3f, 4f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(0.0f, 4f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(0.0f, 0.0f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(1f, 0.0f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(1f, 2f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(2f, 2f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(2f, 3f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(3f, 3f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(3f, 4f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(0.0f, 4f, 1f), Color.White)
   };
   indexedUserPrimitives1.Indices = new int[50]
   {
     0,
     1,
     1,
     2,
     2,
     3,
     3,
     4,
     4,
     5,
     5,
     6,
     6,
     7,
     7,
     0,
     8,
     9,
     9,
     10,
     10,
     11,
     11,
     12,
     12,
     13,
     13,
     14,
     14,
     15,
     15,
     8,
     0,
     8,
     1,
     9,
     2,
     10,
     3,
     11,
     4,
     12,
     5,
     13,
     6,
     14,
     7,
     15,
     0,
     8
   };
   Group group2 = this.WireMesh.AddGroup();
   IndexedUserPrimitives<FezVertexPositionColor> indexedUserPrimitives2 = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.LineList);
   group2.Geometry = (IIndexedPrimitiveCollection) indexedUserPrimitives2;
   indexedUserPrimitives2.Vertices = new FezVertexPositionColor[20]
   {
     new FezVertexPositionColor(new Vector3(4f, 0.0f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(7f, 0.0f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(7f, 1f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(5f, 1f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(5f, 2f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(6f, 2f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(6f, 3f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(7f, 3f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(7f, 4f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(4f, 4f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(4f, 0.0f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(7f, 0.0f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(7f, 1f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(5f, 1f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(5f, 2f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(6f, 2f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(6f, 3f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(7f, 3f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(7f, 4f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(4f, 4f, 1f), Color.White)
   };
   indexedUserPrimitives2.Indices = new int[60]
   {
     0,
     1,
     1,
     2,
     2,
     3,
     3,
     4,
     4,
     5,
     5,
     6,
     6,
     7,
     7,
     8,
     8,
     9,
     9,
     0,
     10,
     11,
     11,
     12,
     12,
     13,
     13,
     14,
     14,
     15,
     15,
     16,
     16,
     17,
     17,
     18,
     18,
     19,
     19,
     10,
     0,
     10,
     1,
     11,
     2,
     12,
     3,
     13,
     4,
     14,
     5,
     15,
     6,
     16,
     7,
     17,
     8,
     18,
     9,
     19
   };
   Group group3 = this.WireMesh.AddGroup();
   IndexedUserPrimitives<FezVertexPositionColor> indexedUserPrimitives3 = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.LineList);
   group3.Geometry = (IIndexedPrimitiveCollection) indexedUserPrimitives3;
   indexedUserPrimitives3.Vertices = new FezVertexPositionColor[22]
   {
     new FezVertexPositionColor(new Vector3(8f, 0.0f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(11f, 0.0f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(11f, 1f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(10f, 1f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(10f, 2f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(11f, 2f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(11f, 4f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(8f, 4f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(8f, 3f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(10f, 3f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(8f, 2f, 0.0f), Color.White),
     new FezVertexPositionColor(new Vector3(8f, 0.0f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(11f, 0.0f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(11f, 1f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(10f, 1f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(10f, 2f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(11f, 2f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(11f, 4f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(8f, 4f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(8f, 3f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(10f, 3f, 1f), Color.White),
     new FezVertexPositionColor(new Vector3(8f, 2f, 1f), Color.White)
   };
   indexedUserPrimitives3.Indices = new int[70]
   {
     0,
     1,
     1,
     2,
     2,
     3,
     3,
     4,
     4,
     5,
     5,
     6,
     6,
     7,
     7,
     8,
     8,
     9,
     9,
     4,
     4,
     10,
     10,
     0,
     11,
     12,
     12,
     13,
     13,
     14,
     14,
     15,
     15,
     16,
     16,
     17,
     17,
     18,
     18,
     19,
     19,
     20,
     20,
     15,
     15,
     21,
     21,
     11,
     0,
     11,
     1,
     12,
     2,
     13,
     3,
     14,
     4,
     15,
     5,
     16,
     6,
     17,
     7,
     18,
     8,
     19,
     9,
     20,
     10,
     21
   };
   this.WireMesh.Position = this.LogoMesh.Position = new Vector3(-5.5f, -2f, -0.5f);
   this.WireMesh.BakeTransform<FezVertexPositionColor>();
   this.LogoMesh.BakeTransform<FezVertexPositionColor>();
   ContentManager contentManager = this.CMProvider.Get(CM.Menu);
   this.sGlitch1 = contentManager.Load<SoundEffect>("Sounds/Intro/FezLogoGlitch1");
   this.sGlitch2 = contentManager.Load<SoundEffect>("Sounds/Intro/FezLogoGlitch2");
   this.sGlitch3 = contentManager.Load<SoundEffect>("Sounds/Intro/FezLogoGlitch3");
   ServiceHelper.AddComponent((IGameComponent) (this.Starfield = new StarField(this.Game)));
   this.Starfield.Opacity = 0.0f;
   this.LogoMesh.Material.Opacity = 0.0f;
   this.untilGlitch = RandomHelper.Between(1.0 / 3.0, 1.0);
 }
Пример #14
0
 public override void Initialize()
 {
   base.Initialize();
   this.GTR = new GlyphTextRenderer(this.Game);
   this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
   this.Scripting.CutsceneSkipped += new Action(this.OnCutsceneSkipped);
   this.Vertices = new List<Vector4>()
   {
     new Vector4(-1f, -1f, -1f, -1f),
     new Vector4(1f, -1f, -1f, -1f),
     new Vector4(-1f, 1f, -1f, -1f),
     new Vector4(1f, 1f, -1f, -1f),
     new Vector4(-1f, -1f, 1f, -1f),
     new Vector4(1f, -1f, 1f, -1f),
     new Vector4(-1f, 1f, 1f, -1f),
     new Vector4(1f, 1f, 1f, -1f),
     new Vector4(-1f, -1f, -1f, 1f),
     new Vector4(1f, -1f, -1f, 1f),
     new Vector4(-1f, 1f, -1f, 1f),
     new Vector4(1f, 1f, -1f, 1f),
     new Vector4(-1f, -1f, 1f, 1f),
     new Vector4(1f, -1f, 1f, 1f),
     new Vector4(-1f, 1f, 1f, 1f),
     new Vector4(1f, 1f, 1f, 1f)
   };
   this.DotMesh = new Mesh()
   {
     Effect = (BaseEffect) new DotEffect(),
     Blending = new BlendingMode?(BlendingMode.Additive),
     DepthWrites = false,
     Culling = CullMode.None,
     AlwaysOnTop = true,
     Material = {
       Opacity = 0.3333333f
     }
   };
   this.RaysMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/smooth_ray")),
     Blending = new BlendingMode?(BlendingMode.Additive),
     SamplerState = SamplerState.AnisotropicClamp,
     DepthWrites = false,
     AlwaysOnTop = true
   };
   this.FlareMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/rainbow_flare")),
     Blending = new BlendingMode?(BlendingMode.Additive),
     SamplerState = SamplerState.AnisotropicClamp,
     DepthWrites = false,
     AlwaysOnTop = true
   };
   DotHost dotHost = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
   textured1.IgnoreCache = true;
   DefaultEffect.Textured textured2 = textured1;
   mesh2.Effect = (BaseEffect) textured2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending);
   mesh1.SamplerState = SamplerStates.PointMipClamp;
   mesh1.DepthWrites = false;
   mesh1.AlwaysOnTop = true;
   Mesh mesh3 = mesh1;
   dotHost.VignetteMesh = mesh3;
   this.VignetteMesh.AddFace(new Vector3(1f), Vector3.Zero, FaceOrientation.Front, true);
   this.BPromptMesh = new Mesh()
   {
     AlwaysOnTop = true,
     SamplerState = SamplerState.PointClamp,
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     Effect = (BaseEffect) new DefaultEffect.Textured()
   };
   this.BPromptMesh.AddFace(new Vector3(1f, 1f, 0.0f), Vector3.Zero, FaceOrientation.Front, false);
   this.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true);
   this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) (this.DotWireGeometry = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.LineList));
   this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) (this.DotFacesGeometry = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.TriangleList));
   this.DotWireGeometry.Vertices = new FezVertexPositionColor[16];
   for (int index = 0; index < 16; ++index)
     this.DotWireGeometry.Vertices[index].Color = new Color(1f, 1f, 1f, 1f);
   this.DotWireGeometry.Indices = new int[64]
   {
     0,
     1,
     0,
     2,
     2,
     3,
     3,
     1,
     4,
     5,
     6,
     7,
     4,
     6,
     5,
     7,
     4,
     0,
     6,
     2,
     3,
     7,
     1,
     5,
     10,
     11,
     8,
     9,
     8,
     10,
     9,
     11,
     12,
     14,
     14,
     15,
     15,
     13,
     12,
     13,
     12,
     8,
     14,
     10,
     15,
     11,
     13,
     9,
     2,
     10,
     3,
     11,
     0,
     8,
     1,
     9,
     6,
     14,
     7,
     15,
     4,
     12,
     5,
     13
   };
   this.DotFacesGeometry.Vertices = new FezVertexPositionColor[96];
   for (int index1 = 0; index1 < 4; ++index1)
   {
     for (int index2 = 0; index2 < 6; ++index2)
     {
       Vector3 vector3 = Vector3.Zero;
       switch ((index2 + index1 * 6) % 6)
       {
         case 0:
           vector3 = new Vector3(0.0f, 1f, 0.75f);
           break;
         case 1:
           vector3 = new Vector3(0.1666667f, 1f, 0.75f);
           break;
         case 2:
           vector3 = new Vector3(0.3333333f, 1f, 0.75f);
           break;
         case 3:
           vector3 = new Vector3(0.5f, 1f, 0.75f);
           break;
         case 4:
           vector3 = new Vector3(0.6666667f, 1f, 0.75f);
           break;
         case 5:
           vector3 = new Vector3(0.8333333f, 1f, 0.75f);
           break;
       }
       for (int index3 = 0; index3 < 4; ++index3)
         this.DotFacesGeometry.Vertices[index3 + index2 * 4 + index1 * 24].Color = new Color(vector3.X, vector3.Y, vector3.Z);
     }
   }
   this.FaceVertexIndices = new int[96]
   {
     0,
     2,
     3,
     1,
     1,
     3,
     7,
     5,
     5,
     7,
     6,
     4,
     4,
     6,
     2,
     0,
     0,
     4,
     5,
     1,
     2,
     6,
     7,
     3,
     8,
     10,
     11,
     9,
     9,
     11,
     15,
     13,
     13,
     15,
     14,
     12,
     12,
     14,
     10,
     8,
     8,
     12,
     13,
     9,
     10,
     14,
     15,
     11,
     0,
     1,
     9,
     8,
     0,
     2,
     10,
     8,
     2,
     3,
     11,
     10,
     3,
     1,
     9,
     11,
     4,
     5,
     13,
     12,
     6,
     7,
     15,
     14,
     4,
     6,
     14,
     12,
     5,
     7,
     15,
     13,
     4,
     0,
     8,
     12,
     6,
     2,
     10,
     14,
     3,
     7,
     15,
     11,
     1,
     5,
     13,
     9
   };
   this.DotFacesGeometry.Indices = new int[144]
   {
     0,
     2,
     1,
     0,
     3,
     2,
     4,
     6,
     5,
     4,
     7,
     6,
     8,
     10,
     9,
     8,
     11,
     10,
     12,
     14,
     13,
     12,
     15,
     14,
     16,
     17,
     18,
     16,
     18,
     19,
     20,
     22,
     21,
     20,
     23,
     22,
     24,
     26,
     25,
     24,
     27,
     26,
     28,
     30,
     29,
     28,
     31,
     30,
     32,
     34,
     33,
     32,
     35,
     34,
     36,
     38,
     37,
     36,
     39,
     38,
     40,
     41,
     42,
     40,
     42,
     43,
     44,
     46,
     45,
     44,
     47,
     46,
     48,
     50,
     49,
     48,
     51,
     50,
     52,
     54,
     53,
     52,
     55,
     54,
     56,
     58,
     57,
     56,
     59,
     58,
     60,
     62,
     61,
     60,
     63,
     62,
     64,
     65,
     66,
     64,
     66,
     67,
     68,
     70,
     69,
     68,
     71,
     70,
     72,
     74,
     73,
     72,
     75,
     74,
     76,
     78,
     77,
     76,
     79,
     78,
     80,
     82,
     81,
     80,
     83,
     82,
     84,
     86,
     85,
     84,
     87,
     86,
     88,
     89,
     90,
     88,
     90,
     91,
     92,
     94,
     93,
     92,
     95,
     94
   };
   this.sHide = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Hide");
   this.sComeOut = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/ComeOut");
   this.sMove = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Move");
   this.sIdle = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Idle");
   this.sHeyListen = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/HeyListen");
   this.LevelManager.LevelChanged += new Action(this.RebuildFlare);
 }