Example #1
0
 public override BaseEffect Clone()
 {
     DefaultEffect.LitTextured litTextured = new DefaultEffect.LitTextured();
     litTextured.Specular        = this.Specular;
     litTextured.AlphaIsEmissive = this.AlphaIsEmissive;
     litTextured.Emissive        = this.Emissive;
     litTextured.Fullbright      = this.Fullbright;
     return((BaseEffect)litTextured);
 }
Example #2
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();
 }
Example #3
0
 private void TryInitialize()
 {
   if (this.WireframeCube == null)
   {
     this.WireframeCube = new Mesh()
     {
       Effect = (BaseEffect) (this.SplitCollectorEffect = new SplitCollectorEffect()),
       Material = {
         Diffuse = Vector3.One,
         Opacity = 1f
       },
       Blending = new BlendingMode?(BlendingMode.Alphablending)
     };
     for (int index = 0; index < 7; ++index)
     {
       this.WireframeCube.AddWireframeBox(Vector3.One, Vector3.Zero, new Color(index == 0 ? 1f : (index == 1 ? 0.0f : 0.5f), index == 2 ? 1f : (index == 3 ? 0.0f : 0.5f), index == 4 ? 1f : (index == 5 ? 0.0f : 0.5f), index == 6 ? 1f : 0.0f), true);
       foreach (Vector3 origin in this.CubeOffsets)
         this.WireframeCube.AddWireframeBox(Vector3.One / 2f, origin, new Color(index == 0 ? 1f : (index == 1 ? 0.0f : 0.5f), index == 2 ? 1f : (index == 3 ? 0.0f : 0.5f), index == 4 ? 1f : (index == 5 ? 0.0f : 0.5f), index == 6 ? 0.625f : 0.375f), true);
     }
     this.WireframeCube.CollapseToBuffer<FezVertexPositionColor>();
   }
   this.SolidCubesVisible = true;
   if (this.TrackedCollects.Count > 0)
   {
     this.GameState.SaveData.CollectedParts += this.TrackedCollects.Count;
     Waiters.Wait(0.5, (Action) (() => Waiters.Wait((Func<bool>) (() =>
     {
       if (this.PlayerManager.CanControl)
         return this.PlayerManager.Grounded;
       else
         return false;
     }), (Action) (() =>
     {
       this.GomezService.OnCollectedSplitUpCube();
       this.GameState.OnHudElementChanged();
       this.GameState.Save();
       this.TryAssembleCube();
     }))));
   }
   foreach (SplitUpCubeHost.SwooshingCube swooshingCube in this.TrackedCollects)
     swooshingCube.Dispose();
   this.TrackedCollects.Clear();
   if (this.LevelManager.TrileSet == null)
   {
     this.trailsRenderer.Visible = this.Enabled = this.Visible = false;
   }
   else
   {
     Trile goldenCubeTrile = Enumerable.FirstOrDefault<Trile>(this.LevelManager.ActorTriles(ActorType.GoldenCube));
     IEnumerable<TrileInstance> source = Enumerable.Union<TrileInstance>((IEnumerable<TrileInstance>) this.LevelManager.Triles.Values, Enumerable.SelectMany<KeyValuePair<TrileEmplacement, TrileInstance>, TrileInstance>((IEnumerable<KeyValuePair<TrileEmplacement, TrileInstance>>) this.LevelManager.Triles, (Func<KeyValuePair<TrileEmplacement, TrileInstance>, IEnumerable<TrileInstance>>) (x => (IEnumerable<TrileInstance>) x.Value.OverlappedTriles ?? Enumerable.Empty<TrileInstance>())));
     SplitUpCubeHost.TrailsRenderer trailsRenderer = this.trailsRenderer;
     SplitUpCubeHost splitUpCubeHost = this;
     bool flag1;
     this.Visible = flag1 = goldenCubeTrile != null && (Enumerable.Count<TrileInstance>(source, (Func<TrileInstance, bool>) (x => x.TrileId == goldenCubeTrile.Id)) != 0 || this.AssembleScheduled || this.GameState.SaveData.CollectedParts == 8);
     int num1;
     bool flag2 = (num1 = flag1 ? 1 : 0) != 0;
     splitUpCubeHost.Enabled = num1 != 0;
     int num2 = flag2 ? 1 : 0;
     trailsRenderer.Visible = num2 != 0;
     if (!this.Enabled)
       return;
     this.RefreshSounds();
     this.TrackedBits.Clear();
     this.TrackedBits.AddRange(Enumerable.Where<TrileInstance>(source, (Func<TrileInstance, bool>) (x => x.TrileId == goldenCubeTrile.Id)));
     this.SolidCubes.ClearGroups();
     ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry = goldenCubeTrile.Geometry;
     this.SolidCubes.Position = Vector3.Zero;
     this.SolidCubes.Rotation = Quaternion.Identity;
     foreach (Vector3 vector3 in this.CubeOffsets)
     {
       Group group = this.SolidCubes.AddGroup();
       group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(Enumerable.ToArray<VertexPositionNormalTextureInstance>((IEnumerable<VertexPositionNormalTextureInstance>) geometry.Vertices), geometry.Indices, geometry.PrimitiveType);
       group.Position = vector3;
       group.BakeTransform<VertexPositionNormalTextureInstance>();
     }
     this.SolidCubes.Texture = this.LevelMaterializer.TrilesMesh.Texture;
     this.SolidCubes.Rotation = this.WireframeCube.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float) Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f);
     this.WireOpacityFactor = 1f;
     this.SinceNoTrails = 3f;
     this.ShineOn = (TrileInstance) null;
     this.UntilNextShine = 7f;
     if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha)
     {
       if (this.SolidCubes.Effect is DefaultEffect.LitTextured)
       {
         Mesh mesh = this.SolidCubes;
         DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
         textured1.AlphaIsEmissive = true;
         textured1.IgnoreCache = true;
         DefaultEffect.Textured textured2 = textured1;
         mesh.Effect = (BaseEffect) textured2;
       }
     }
     else if (this.SolidCubes.Effect is DefaultEffect.Textured)
     {
       Mesh mesh = this.SolidCubes;
       DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
       litTextured1.Specular = true;
       litTextured1.Emissive = 0.5f;
       litTextured1.AlphaIsEmissive = true;
       litTextured1.IgnoreCache = true;
       DefaultEffect.LitTextured litTextured2 = litTextured1;
       mesh.Effect = (BaseEffect) litTextured2;
     }
     this.TryAssembleCube();
   }
 }
Example #4
0
 protected override void LoadContent()
 {
   SplitUpCubeHost splitUpCubeHost1 = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
   litTextured1.Specular = true;
   litTextured1.Emissive = 0.5f;
   litTextured1.AlphaIsEmissive = true;
   DefaultEffect.LitTextured litTextured2 = litTextured1;
   mesh2.Effect = (BaseEffect) litTextured2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending);
   Mesh mesh3 = mesh1;
   splitUpCubeHost1.SolidCubes = mesh3;
   SplitUpCubeHost splitUpCubeHost2 = this;
   Mesh mesh4 = new Mesh();
   Mesh mesh5 = mesh4;
   DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored();
   vertexColored1.Fullbright = true;
   vertexColored1.AlphaIsEmissive = false;
   DefaultEffect.VertexColored vertexColored2 = vertexColored1;
   mesh5.Effect = (BaseEffect) vertexColored2;
   mesh4.DepthWrites = false;
   Mesh mesh6 = mesh4;
   splitUpCubeHost2.ChimeOutline = mesh6;
   this.ChimeOutline.AddWireframePolygon(Color.Yellow, new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
   this.ChimeOutline.AddWireframePolygon(new Color(Color.Yellow.ToVector3() * 0.3333333f), new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
   this.ChimeOutline.AddWireframePolygon(new Color(Color.Yellow.ToVector3() * 0.1111111f), new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
   this.ChimeOutline.AddWireframePolygon(new Color(Color.Yellow.ToVector3() * 0.03703704f), new Vector3(0.0f, 0.7071068f, 0.0f), new Vector3(0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, -0.7071068f, 0.0f), new Vector3(-0.7071068f, 0.0f, 0.0f), new Vector3(0.0f, 0.7071068f, 0.0f));
   this.sBitChime = this.CMProvider.Global.Load<SoundEffect>("Sounds/Collects/BitChime");
 }
Example #5
0
 protected override void LoadContent()
 {
   TrileSet trileSet = this.CMProvider.Global.Load<TrileSet>("Trile Sets/LOADING");
   float viewAspect = 1.777778f;
   LoadingScreen loadingScreen = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
   litTextured1.Specular = true;
   litTextured1.AlphaIsEmissive = true;
   litTextured1.Emissive = 0.5f;
   litTextured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f));
   litTextured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
   DefaultEffect.LitTextured litTextured2 = litTextured1;
   mesh2.Effect = (BaseEffect) litTextured2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending);
   mesh1.SamplerState = SamplerState.PointClamp;
   mesh1.AlwaysOnTop = false;
   mesh1.DepthWrites = true;
   mesh1.Texture = (Dirtyable<Texture>) ((Texture) trileSet.TextureAtlas);
   mesh1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float) Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f);
   mesh1.Position = new Vector3(5.5f * viewAspect, -4.5f, 0.0f);
   Mesh mesh3 = mesh1;
   loadingScreen.mesh = mesh3;
   Group group = this.mesh.AddGroup();
   ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry = trileSet.Triles[0].Geometry;
   group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(Enumerable.ToArray<VertexPositionNormalTextureInstance>((IEnumerable<VertexPositionNormalTextureInstance>) geometry.Vertices), geometry.Indices, geometry.PrimitiveType);
   group.Scale = new Vector3(0.95f);
   this.starBack = this.CMProvider.Global.Load<Texture2D>("Other Textures/hud/starback");
   this.sDrone = this.CMProvider.Global.Load<SoundEffect>("Sounds/Intro/FezLogoDrone");
   ServiceHelper.AddComponent((IGameComponent) (this.fakeDot = new FakeDot(ServiceHelper.Game)));
   this.LevelManager.LevelChanged += (Action) (() =>
   {
     lock (LoadingScreen.EffectRefreshMutex)
     {
       if (this.mesh.Effect != null)
         this.mesh.Effect.Dispose();
       if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha)
       {
         Mesh temp_131 = this.mesh;
         DefaultEffect.Textured temp_135 = new DefaultEffect.Textured()
         {
           AlphaIsEmissive = true
         };
         temp_131.Effect = (BaseEffect) temp_135;
       }
       else
       {
         Mesh temp_179 = this.mesh;
         DefaultEffect.LitTextured temp_187 = new DefaultEffect.LitTextured()
         {
           Specular = true,
           Emissive = 0.5f,
           AlphaIsEmissive = true
         };
         temp_179.Effect = (BaseEffect) temp_187;
       }
       this.mesh.Effect.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f));
       this.mesh.Effect.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
       this.mesh.TextureMatrix.Dirty = true;
     }
   });
 }
Example #6
0
 private void CreateMapsFace()
 {
   bool flag = this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha;
   MenuCube menuCube = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
   litTextured1.Fullbright = flag;
   DefaultEffect.LitTextured litTextured2 = litTextured1;
   mesh2.Effect = (BaseEffect) litTextured2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending);
   mesh1.Material = this.AoInstance.Material;
   mesh1.SamplerState = SamplerState.PointClamp;
   Mesh mesh3 = mesh1;
   menuCube.Maps = mesh3;
   Quaternion fromAxisAngle = Quaternion.CreateFromAxisAngle(Vector3.Up, -1.570796f);
   int num1 = 0;
   foreach (string str in this.GameState.SaveData.Maps)
   {
     Texture2D texture2D1 = this.CMProvider.Global.Load<Texture2D>("Other Textures/maps/" + str + "_1");
     Texture2D texture2D2 = this.CMProvider.Global.Load<Texture2D>("Other Textures/maps/" + str + "_2");
     int num2 = (int) Math.Sqrt((double) MenuCubeFaceExtensions.GetCount(MenuCubeFace.Maps));
     Vector2 vector2 = new Vector2((float) (num1 % num2), (float) (num1 / num2));
     Vector3 size = this.AoInstance.ArtObject.Size;
     Vector3 vector3 = (float) ((double) vector2.X * (double) MenuCubeFaceExtensions.GetSpacing(MenuCubeFace.Maps) / 16.0) * MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps) + (float) ((double) vector2.Y * (double) MenuCubeFaceExtensions.GetSpacing(MenuCubeFace.Maps) / 16.0) * -Vector3.UnitY + size / 2f * (MenuCubeFaceExtensions.GetForward(MenuCubeFace.Maps) + Vector3.Up - MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps)) + -MenuCubeFaceExtensions.GetForward(MenuCubeFace.Maps) * (float) MenuCubeFaceExtensions.GetDepth(MenuCubeFace.Maps) / 16f / 2f + (Vector3.Down + MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps)) * (float) MenuCubeFaceExtensions.GetOffset(MenuCubeFace.Maps) / 16f;
     Group group1 = this.Maps.AddGroup();
     group1.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<FezVertexPositionNormalTexture>(new FezVertexPositionNormalTexture[4]
     {
       new FezVertexPositionNormalTexture(new Vector3(-1f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(1f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(-1f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(1f, 1f)),
       new FezVertexPositionNormalTexture(new Vector3(0.0f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.625f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(0.0f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.625f, 1f))
     }, new int[6]
     {
       0,
       1,
       2,
       2,
       1,
       3
     }, PrimitiveType.TriangleList);
     group1.Scale = new Vector3(0.375f, 1f, 1f) * 1.5f;
     group1.Texture = (Texture) texture2D1;
     group1.Position = vector3 + MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps) * 0.125f * 1.5f;
     group1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 0.3926991f) * fromAxisAngle;
     Group group2 = this.Maps.CloneGroup(group1);
     group2.InvertNormals<FezVertexPositionNormalTexture>();
     group2.Texture = (Texture) texture2D2;
     group2.CullMode = new CullMode?(CullMode.CullClockwiseFace);
     group2.TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(-1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 1f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
     Group group3 = this.Maps.AddGroup();
     group3.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<FezVertexPositionNormalTexture>(new FezVertexPositionNormalTexture[4]
     {
       new FezVertexPositionNormalTexture(new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.625f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.625f, 1f)),
       new FezVertexPositionNormalTexture(new Vector3(0.5f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.375f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.375f, 1f))
     }, new int[6]
     {
       0,
       1,
       2,
       2,
       1,
       3
     }, PrimitiveType.TriangleList);
     group3.Scale = new Vector3(0.25f, 1f, 1f) * 1.5f;
     group3.Texture = (Texture) texture2D1;
     group3.Position = vector3;
     group3.Rotation = fromAxisAngle;
     Group group4 = this.Maps.CloneGroup(group3);
     group4.InvertNormals<FezVertexPositionNormalTexture>();
     group4.Texture = (Texture) texture2D2;
     group4.CullMode = new CullMode?(CullMode.CullClockwiseFace);
     group4.TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(-1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 1f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
     Group group5 = this.Maps.AddGroup();
     group5.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<FezVertexPositionNormalTexture>(new FezVertexPositionNormalTexture[4]
     {
       new FezVertexPositionNormalTexture(new Vector3(0.0f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.375f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(0.0f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.375f, 1f)),
       new FezVertexPositionNormalTexture(new Vector3(1f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.0f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(1f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.0f, 1f))
     }, new int[6]
     {
       0,
       1,
       2,
       2,
       1,
       3
     }, PrimitiveType.TriangleList);
     group5.Scale = new Vector3(0.375f, 1f, 1f) * 1.5f;
     group5.Texture = (Texture) texture2D1;
     group5.Position = vector3 - MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps) * 0.125f * 1.5f;
     group5.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 0.3926991f) * fromAxisAngle;
     Group group6 = this.Maps.CloneGroup(group5);
     group6.InvertNormals<FezVertexPositionNormalTexture>();
     group6.Texture = (Texture) texture2D2;
     group6.CullMode = new CullMode?(CullMode.CullClockwiseFace);
     group6.TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(-1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 1f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
     ++num1;
   }
 }
Example #7
0
 private void GenerateCubes()
 {
   Vector3[] vector3Array = new Vector3[64];
   for (int index1 = 0; index1 < 4; ++index1)
   {
     for (int index2 = 0; index2 < 4; ++index2)
     {
       for (int index3 = 0; index3 < 4; ++index3)
         vector3Array[index1 * 16 + index2 * 4 + index3] = new Vector3((float) index1 - 1.5f, (float) index2 - 1.5f, (float) index3 - 1.5f);
     }
   }
   EldersHexahedron eldersHexahedron = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
   litTextured1.Specular = true;
   litTextured1.Emissive = 0.5f;
   litTextured1.AlphaIsEmissive = true;
   DefaultEffect.LitTextured litTextured2 = litTextured1;
   mesh2.Effect = (BaseEffect) litTextured2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Opaque);
   Mesh mesh3 = mesh1;
   eldersHexahedron.SolidCubes = mesh3;
   this.SmallCubes = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.LitTextured()
     {
       Specular = true
     },
     Blending = new BlendingMode?(BlendingMode.Opaque)
   };
   this.SmallCubes.Rotation = this.SolidCubes.Rotation = this.AoRotationOrigin;
   Trile trile1 = Enumerable.FirstOrDefault<Trile>(this.LevelManager.ActorTriles(ActorType.CubeShard));
   Trile trile2 = Enumerable.FirstOrDefault<Trile>(this.LevelManager.ActorTriles(ActorType.GoldenCube));
   foreach (Vector3 vector3 in vector3Array)
   {
     Group group1 = this.SolidCubes.AddGroup();
     group1.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(Enumerable.ToArray<VertexPositionNormalTextureInstance>((IEnumerable<VertexPositionNormalTextureInstance>) trile1.Geometry.Vertices), trile1.Geometry.Indices, trile1.Geometry.PrimitiveType);
     group1.Position = vector3;
     group1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, (float) RandomHelper.Random.Next(0, 4) * 1.570796f);
     group1.BakeTransformWithNormal<VertexPositionNormalTextureInstance>();
     group1.CustomData = (object) new EldersHexahedron.ShardProjectionData()
     {
       Direction = (vector3 * RandomHelper.Between(0.5, 5.0)),
       Spin = Quaternion.CreateFromAxisAngle(RandomHelper.NormalizedVector(), RandomHelper.Between(0.0, Math.PI / 1000.0))
     };
     Group group2 = this.SmallCubes.AddGroup();
     group2.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(Enumerable.ToArray<VertexPositionNormalTextureInstance>((IEnumerable<VertexPositionNormalTextureInstance>) trile2.Geometry.Vertices), trile2.Geometry.Indices, trile2.Geometry.PrimitiveType);
     group2.Position = vector3 * RandomHelper.Between(0.5, 1.0);
     group2.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, (float) RandomHelper.Random.Next(0, 4) * 1.570796f);
     group2.BakeTransformWithNormal<VertexPositionNormalTextureInstance>();
     group2.CustomData = (object) new EldersHexahedron.ShardProjectionData()
     {
       Direction = (vector3 * RandomHelper.Between(0.5, 5.0)),
       Spin = Quaternion.CreateFromAxisAngle(RandomHelper.NormalizedVector(), RandomHelper.Between(0.0, Math.PI / 1000.0))
     };
   }
   this.SolidCubes.Texture = this.SmallCubes.Texture = (Dirtyable<Texture>) ((Texture) this.LevelManager.TrileSet.TextureAtlas);
 }
Example #8
0
 public OpenTreasure(Game game)
   : base(game)
 {
   this.DrawOrder = 50;
   this.lightBox = new Mesh()
   {
     Blending = new BlendingMode?(BlendingMode.Additive),
     SamplerState = SamplerState.LinearClamp,
     DepthWrites = false,
     Scale = new Vector3(1.6f, 1.5f, 1.2f),
     TextureMatrix = (Dirtyable<Matrix>) new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, -1f, 0.0f, 0.0f, 0.0f, 1f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)
   };
   this.lightBox.AddFace(Vector3.One, -Vector3.UnitZ / 2f + Vector3.UnitY / 2f, FaceOrientation.Back, true);
   this.lightBox.AddFace(Vector3.One, Vector3.UnitZ / 2f + Vector3.UnitY / 2f, FaceOrientation.Front, true);
   this.lightBox.AddFace(Vector3.One, Vector3.Left / 2f + Vector3.UnitY / 2f, FaceOrientation.Left, true);
   this.lightBox.AddFace(Vector3.One, Vector3.Right / 2f + Vector3.UnitY / 2f, FaceOrientation.Right, true);
   this.flare = new Mesh()
   {
     Blending = new BlendingMode?(BlendingMode.Additive),
     SamplerState = SamplerState.LinearClamp,
     DepthWrites = false
   };
   this.flare.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true, true);
   this.fadedStar = new Mesh()
   {
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     DepthWrites = false
   };
   this.solidStar = new Mesh()
   {
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     DepthWrites = false
   };
   Color color = new Color(1f, 1f, 0.3f, 0.0f);
   for (int index = 0; index < 8; ++index)
   {
     float num1 = (float) ((double) index * 6.28318548202515 / 8.0);
     float num2 = (float) (((double) index + 0.5) * 6.28318548202515 / 8.0);
     this.fadedStar.AddColoredTriangle(Vector3.Zero, new Vector3((float) Math.Sin((double) num1), (float) Math.Cos((double) num1), 0.0f), new Vector3((float) Math.Sin((double) num2), (float) Math.Cos((double) num2), 0.0f), new Color(1f, 1f, 1f, 0.7f), color, color);
     this.solidStar.AddColoredTriangle(Vector3.Zero, new Vector3((float) Math.Sin((double) num1), (float) Math.Cos((double) num1), 0.0f), new Vector3((float) Math.Sin((double) num2), (float) Math.Cos((double) num2), 0.0f), new Color(1f, 1f, 1f, 0.7f), new Color(1f, 1f, 1f, 0.7f), new Color(1f, 1f, 1f, 0.7f));
   }
   this.map = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.LitTextured(),
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     SamplerState = SamplerState.PointClamp
   };
   OpenTreasure.BuildMap(this.map);
   OpenTreasure openTreasure = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
   litTextured1.Emissive = 0.5f;
   DefaultEffect.LitTextured litTextured2 = litTextured1;
   mesh2.Effect = (BaseEffect) litTextured2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending);
   mesh1.SamplerState = SamplerState.PointClamp;
   mesh1.Scale = new Vector3(1.5f);
   Mesh mesh3 = mesh1;
   openTreasure.mail = mesh3;
   Group group1 = this.mail.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Back, true);
   group1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, -1.570796f);
   Group group2 = this.mail.CloneGroup(group1);
   group2.CullMode = new CullMode?(CullMode.CullClockwiseFace);
   group2.TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(-1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 1f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
 }
Example #9
0
 public override BaseEffect Clone()
 {
   DefaultEffect.LitTextured litTextured = new DefaultEffect.LitTextured();
   litTextured.Specular = this.Specular;
   litTextured.AlphaIsEmissive = this.AlphaIsEmissive;
   litTextured.Emissive = this.Emissive;
   litTextured.Fullbright = this.Fullbright;
   return (BaseEffect) litTextured;
 }
Example #10
0
 private void TryInitialize()
 {
   this.Destroy();
   this.Visible = this.Enabled = this.LevelManager.Name == "HEX_REBUILD";
   if (!this.Enabled)
     return;
   this.GameState.HideHUD = true;
   this.CameraManager.ChangeViewpoint(Viewpoint.Right, 0.0f);
   this.PlayerManager.Background = false;
   ArtObject artObject = this.CMProvider.CurrentLevel.Load<ArtObject>("Art Objects/NEW_HEXAO");
   int key = IdentifierPool.FirstAvailable<ArtObjectInstance>(this.LevelManager.ArtObjects);
   this.HexahedronAo = new ArtObjectInstance(artObject)
   {
     Id = key
   };
   this.LevelManager.ArtObjects.Add(key, this.HexahedronAo);
   this.HexahedronAo.Initialize();
   this.HexahedronAo.Hidden = true;
   this.WhiteCube = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.VertexColored(),
     Blending = new BlendingMode?(BlendingMode.Additive),
     DepthWrites = false
   };
   this.WhiteCube.Rotation = this.CameraManager.Rotation * Quaternion.CreateFromRotationMatrix(Matrix.CreateLookAt(Vector3.One, Vector3.Zero, Vector3.Up));
   this.WhiteCube.AddColoredBox(new Vector3(4f), Vector3.Zero, Color.White, true);
   FinalRebuildHost finalRebuildHost = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
   litTextured1.Specular = true;
   litTextured1.Emissive = 0.5f;
   litTextured1.AlphaIsEmissive = true;
   DefaultEffect.LitTextured litTextured2 = litTextured1;
   mesh2.Effect = (BaseEffect) litTextured2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Opaque);
   Mesh mesh3 = mesh1;
   finalRebuildHost.SolidCubes = mesh3;
   this.OriginalCubeRotation = this.SolidCubes.Rotation = this.WhiteCube.Rotation;
   ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry1 = Enumerable.FirstOrDefault<Trile>(this.LevelManager.ActorTriles(ActorType.CubeShard)).Geometry;
   ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry2 = Enumerable.FirstOrDefault<Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube)).Geometry;
   this.sHexAppear = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/HexAppear");
   this.sCubeAppear = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/CubeAppear");
   this.sMotorSpin1 = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/MotorStart1");
   this.sMotorSpin2 = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/MotorStart2");
   this.sMotorSpinAOK = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/MotorStartAOK");
   this.sMotorSpinCrash = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/MotorStartCrash");
   this.sRayWhiteout = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/RayWhiteout");
   this.sAku = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/Aku");
   this.sZoomIn = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/ZoomIn");
   this.sAmbientDrone = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Ending/HexRebuild/AmbientDrone");
   for (int index = 0; index < Math.Min(this.GameState.SaveData.CubeShards + this.GameState.SaveData.SecretCubes, 64); ++index)
   {
     Vector3 vector3 = this.CubeOffsets[index];
     ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> indexedPrimitives = index < this.GameState.SaveData.CubeShards ? geometry1 : geometry2;
     Group group = this.SolidCubes.AddGroup();
     group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(Enumerable.ToArray<VertexPositionNormalTextureInstance>((IEnumerable<VertexPositionNormalTextureInstance>) indexedPrimitives.Vertices), indexedPrimitives.Indices, indexedPrimitives.PrimitiveType);
     group.Position = vector3;
     group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, (float) RandomHelper.Random.Next(0, 4) * 1.570796f);
     group.Enabled = false;
     group.Material = new Material();
   }
   this.SolidCubes.Texture = this.LevelMaterializer.TrilesMesh.Texture;
   this.InvertEffect = new InvertEffect();
   this.RaysMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.VertexColored(),
     Blending = new BlendingMode?(BlendingMode.Additive),
     DepthWrites = false
   };
   this.FlareMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/flare_alpha")),
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     SamplerState = SamplerState.AnisotropicClamp,
     DepthWrites = false,
     AlwaysOnTop = true
   };
   this.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true);
   this.RtHandle = this.TargetRenderer.TakeTarget();
   this.TargetRenderer.ScheduleHook(this.DrawOrder, this.RtHandle.Target);
   ServiceHelper.AddComponent((IGameComponent) (this.Glitches = new NesGlitches(this.Game)));
 }
Example #11
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;
 }