コード例 #1
0
ファイル: GameLevelMaterializer.cs プロジェクト: Zeludon/FEZ
 public override void RebuildTrile(Trile trile)
 {
   TrileMaterializer trileMaterializer = new TrileMaterializer(trile, this.TrilesMesh, false);
   this.trileMaterializers.Add(trile, trileMaterializer);
   trileMaterializer.Geometry = trile.Geometry;
   trileMaterializer.DetermineFlags();
 }
コード例 #2
0
        public InstancePhysicsState(TrileInstance instance)
        {
            this.instance        = instance;
            this.Center          = instance.Center;
            this.CornerCollision = new PointCollision[4];
            Trile trile = instance.Trile;

            this.Elasticity = trile.ActorSettings.Type == ActorType.Vase || Enumerable.Any <CollisionType>((IEnumerable <CollisionType>)trile.Faces.Values, (Func <CollisionType, bool>)(x => x == CollisionType.AllSides)) ? 0.0f : 0.15f;
        }
コード例 #3
0
ファイル: TrileInstance.cs プロジェクト: conankzhang/fez
 public void ResetTrile()
 {
     this.VisualTrile = this.Trile = (Trile)null;
     if (TrileInstance.LevelManager.TrileSet != null && !TrileInstance.LevelManager.TrileSet.Triles.ContainsKey(this.TrileId))
     {
         this.TrileId = -1;
     }
     this.RefreshTrile();
 }
コード例 #4
0
 public void CopyFrom(Trile copy)
 {
     this.ActorSettings = new TrileActorSettings(copy.ActorSettings);
     this.Faces         = new Dictionary <FaceOrientation, CollisionType>((IDictionary <FaceOrientation, CollisionType>)copy.Faces);
     this.Immaterial    = copy.Immaterial;
     this.Thin          = copy.Thin;
     this.Name          = copy.Name;
     this.ForceHugging  = copy.ForceHugging;
     this.SeeThrough    = copy.SeeThrough;
     this.SurfaceType   = copy.SurfaceType;
 }
コード例 #5
0
 public bool IsBorderTrixelFace(TrixelEmplacement traversed)
 {
     if (Trile.TrixelInRange(traversed))
     {
         return(!this.TrixelExists(traversed));
     }
     else
     {
         return(true);
     }
 }
コード例 #6
0
ファイル: TrileInstance.cs プロジェクト: conankzhang/fez
 public void RefreshTrile()
 {
     this.Trile = TrileInstance.LevelManager.SafeGetTrile(this.TrileId);
     if (this.VisualTrileId.HasValue)
     {
         this.VisualTrile = TrileInstance.LevelManager.SafeGetTrile(this.VisualTrileId.Value);
     }
     else
     {
         this.VisualTrile = this.Trile;
     }
 }
コード例 #7
0
ファイル: Quantumizer.cs プロジェクト: Zeludon/FEZ
 private void TryInitialize()
 {
   this.BatchedInstances.Clear();
   this.BatchedInstancesSet.Clear();
   this.CleanInstances.Clear();
   this.AllEmplacements.Clear();
   this.AllEmplacements.TrimExcess();
   this.CleanInstances.TrimExcess();
   this.BatchedInstances.TrimExcess();
   this.RandomTrileIds = (int[]) null;
   if (this.Enabled)
     this.LevelMaterializer.TrileInstanceBatched -= new Action<TrileInstance>(this.BatchInstance);
   this.Enabled = false;
   if (!this.LevelManager.Quantum || this.LevelManager.TrileSet == null)
     return;
   this.Enabled = true;
   List<int> list1 = Enumerable.ToList<int>(Enumerable.Select<Trile, int>(Enumerable.Where<Trile>(this.LevelMaterializer.MaterializedTriles, (Func<Trile, bool>) (x =>
   {
     if (x.Geometry != null && !x.Geometry.Empty && !ActorTypeExtensions.IsTreasure(x.ActorSettings.Type))
       return x.ActorSettings.Type != ActorType.SplitUpCube;
     else
       return false;
   })), (Func<Trile, int>) (x => x.Id)));
   this.RandomTrileIds = new int[250];
   int num = 0;
   for (int index1 = 0; index1 < 250; ++index1)
   {
     int index2 = Quantumizer.Random.Next(0, list1.Count);
     int index3 = list1[index2];
     this.RandomTrileIds[num++] = index3;
     this.LevelManager.TrileSet[index3].ForceKeep = true;
     list1.RemoveAt(index2);
   }
   Trile trile = Enumerable.FirstOrDefault<Trile>((IEnumerable<Trile>) this.LevelManager.TrileSet.Triles.Values, (Func<Trile, bool>) (x => x.Name == "__QIPT"));
   if (trile == null)
   {
     trile = new Trile(CollisionType.None)
     {
       Name = "__QIPT",
       Immaterial = true,
       SeeThrough = true,
       Thin = true,
       TrileSet = this.LevelManager.TrileSet,
       MissingTrixels = (TrixelCluster) null,
       Id = IdentifierPool.FirstAvailable<Trile>((IDictionary<int, Trile>) this.LevelManager.TrileSet.Triles)
     };
     this.LevelManager.TrileSet.Triles.Add(trile.Id, trile);
     this.LevelMaterializer.RebuildTrile(trile);
   }
   List<int> list2 = new List<int>();
   bool flag = (double) this.LevelManager.Size.X > (double) this.LevelManager.Size.Z;
   float[] numArray = new float[4]
   {
     0.0f,
     1.570796f,
     3.141593f,
     4.712389f
   };
   for (int y = 0; (double) y < (double) this.LevelManager.Size.Y; ++y)
   {
     if (flag)
     {
       list2.Clear();
       list2.AddRange(Enumerable.Range(0, (int) this.LevelManager.Size.Z));
       for (int x = 0; (double) x < (double) this.LevelManager.Size.X; ++x)
       {
         int z;
         if (list2.Count > 0)
         {
           int index = RandomHelper.Random.Next(0, list2.Count);
           z = list2[index];
           list2.RemoveAt(index);
         }
         else
           z = RandomHelper.Random.Next(0, (int) this.LevelManager.Size.Z);
         this.LevelManager.RestoreTrile(new TrileInstance(new TrileEmplacement(x, y, z), trile.Id)
         {
           Phi = numArray[Quantumizer.Random.Next(0, 4)]
         });
       }
       while (list2.Count > 0)
       {
         int index = RandomHelper.Random.Next(0, list2.Count);
         int z = list2[index];
         list2.RemoveAt(index);
         this.LevelManager.RestoreTrile(new TrileInstance(new TrileEmplacement(RandomHelper.Random.Next(0, (int) this.LevelManager.Size.X), y, z), trile.Id)
         {
           Phi = numArray[Quantumizer.Random.Next(0, 4)]
         });
       }
     }
     else
     {
       list2.Clear();
       list2.AddRange(Enumerable.Range(0, (int) this.LevelManager.Size.X));
       for (int z = 0; (double) z < (double) this.LevelManager.Size.Z; ++z)
       {
         int x;
         if (list2.Count > 0)
         {
           int index = RandomHelper.Random.Next(0, list2.Count);
           x = list2[index];
           list2.RemoveAt(index);
         }
         else
           x = RandomHelper.Random.Next(0, (int) this.LevelManager.Size.X);
         this.LevelManager.RestoreTrile(new TrileInstance(new TrileEmplacement(x, y, z), trile.Id)
         {
           Phi = numArray[Quantumizer.Random.Next(0, 4)]
         });
       }
       while (list2.Count > 0)
       {
         int index = RandomHelper.Random.Next(0, list2.Count);
         int x = list2[index];
         list2.RemoveAt(index);
         this.LevelManager.RestoreTrile(new TrileInstance(new TrileEmplacement(x, y, RandomHelper.Random.Next(0, (int) this.LevelManager.Size.Z)), trile.Id)
         {
           Phi = numArray[Quantumizer.Random.Next(0, 4)]
         });
       }
     }
   }
   foreach (TrileInstance trileInstance in (IEnumerable<TrileInstance>) this.LevelManager.Triles.Values)
   {
     trileInstance.VisualTrileId = new int?(this.RandomTrileIds[Quantumizer.Random.Next(0, this.RandomTrileIds.Length)]);
     trileInstance.RefreshTrile();
     trileInstance.NeedsRandomCleanup = true;
   }
   this.LevelMaterializer.CleanUp();
   this.LevelMaterializer.TrileInstanceBatched += new Action<TrileInstance>(this.BatchInstance);
 }
コード例 #8
0
 public bool CanContain(TrixelEmplacement trixel)
 {
     return(Trile.TrixelInRange(trixel));
 }
コード例 #9
0
ファイル: TrileInstance.cs プロジェクト: tanis2000/FEZ
 public void ResetTrile()
 {
   this.VisualTrile = this.Trile = (Trile) null;
   if (TrileInstance.LevelManager.TrileSet != null && !TrileInstance.LevelManager.TrileSet.Triles.ContainsKey(this.TrileId))
     this.TrileId = -1;
   this.RefreshTrile();
 }
コード例 #10
0
ファイル: TrileMaterializer.cs プロジェクト: Zeludon/FEZ
 public TrileMaterializer(Trile trile)
   : this(trile, (Mesh) null)
 {
 }
コード例 #11
0
ファイル: TrileMaterializer.cs プロジェクト: Zeludon/FEZ
 public TrileMaterializer(Trile trile, Mesh levelMesh)
   : this(trile, levelMesh, false)
 {
 }
コード例 #12
0
ファイル: OpenTreasure.cs プロジェクト: tanis2000/FEZ
 protected override void Begin()
 {
   bool flag = this.PlayerManager.Action == ActionType.OpeningTreasure;
   this.sinceActive = flag ? TimeSpan.FromSeconds(-1.0) : TimeSpan.Zero;
   if (flag)
   {
     this.oldDepth = FezMath.Dot(this.PlayerManager.Position, FezMath.DepthMask(this.CameraManager.Viewpoint));
     this.PlayerManager.Position = this.PlayerManager.Position * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) + this.chestAO.Position * FezMath.DepthMask(this.CameraManager.Viewpoint) + FezMath.ForwardVector(this.CameraManager.Viewpoint) * -1.5f;
     this.PlayerManager.LookingDirection = HorizontalDirection.Right;
     this.aoOrigin = this.chestAO.Position;
     this.chestAO.ActorSettings.Inactive = true;
   }
   else
   {
     if (this.PlayerManager.ForcedTreasure != null)
     {
       this.treasureIsMap = false;
       this.treasureInstance = this.PlayerManager.ForcedTreasure;
       this.treasureIsAo = false;
       this.chestAO = (ArtObjectInstance) null;
       this.treasureTrile = this.treasureInstance.Trile;
       this.treasureActorType = this.treasureTrile.ActorSettings.Type;
       this.PlayerManager.Action = ActionType.FindingTreasure;
       this.sinceCollect = TimeSpan.Zero;
       this.oldDepth = FezMath.Dot(this.PlayerManager.Position, FezMath.DepthMask(this.CameraManager.Viewpoint));
       this.PlayerManager.Position = this.PlayerManager.Position * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) + this.treasureInstance.Position * FezMath.DepthMask(this.CameraManager.Viewpoint) + 2f * -FezMath.ForwardVector(this.CameraManager.Viewpoint);
     }
     this.aoOrigin = this.treasureIsMap ? this.treasureAoInstance.Position : this.treasureInstance.Position;
     this.sinceActive = TimeSpan.FromSeconds(OpenTreasure.OpeningDuration.TotalSeconds * 0.600000023841858);
     SoundEffectExtensions.Emit(this.assembleSound);
   }
   if (!flag)
     this.PlayerManager.Velocity = new Vector3(0.0f, 0.05f, 0.0f);
   this.WasConstrained = this.CameraManager.Constrained;
   if (this.WasConstrained)
   {
     this.OldCenter = this.CameraManager.Center;
     this.OldPixPerTrix = this.CameraManager.PixelsPerTrixel;
   }
   this.OldPan = this.CameraManager.PanningConstraints;
   this.CameraManager.Constrained = true;
   this.CameraManager.PanningConstraints = new Vector2?();
   this.CameraManager.Center = this.aoOrigin;
   if (!flag)
   {
     this.lastZoom = this.CameraManager.PixelsPerTrixel;
     this.CameraManager.PixelsPerTrixel = 4f;
   }
   if (flag)
     this.aoInitialRotation = this.lightBox.Rotation = this.solidStar.Rotation = this.fadedStar.Rotation = this.flare.Rotation = this.chestAO.Rotation;
   else
     this.solidStar.Rotation = this.fadedStar.Rotation = this.flare.Rotation = Quaternion.Inverse(this.CameraManager.Rotation);
   this.lightBox.Position = this.aoOrigin - Vector3.UnitY / 2f;
   this.reculled = this.restored = false;
   if (flag)
   {
     this.treasureAo = (ArtObject) null;
     this.treasureTrile = (Trile) null;
     this.treasureIsMap = this.treasureIsAo = false;
     this.treasureActorType = this.chestAO.ActorSettings.ContainedTrile;
     if (this.chestAO.ActorSettings.ContainedTrile == ActorType.TreasureMap)
       this.treasureIsMap = true;
     else if (this.chestAO.ActorSettings.ContainedTrile == ActorType.Mail)
       this.treasureIsMail = true;
     else if (ActorTypeExtensions.SupportsArtObjects(this.chestAO.ActorSettings.ContainedTrile))
     {
       this.treasureAo = this.CMProvider.Global.Load<ArtObject>("Art Objects/" + ActorTypeExtensions.GetArtObjectName(this.chestAO.ActorSettings.ContainedTrile));
       this.treasureIsAo = true;
     }
     else
       this.treasureTrile = Enumerable.LastOrDefault<Trile>(this.LevelManager.ActorTriles(this.chestAO.ActorSettings.ContainedTrile));
     Waiters.Wait(1.0, (Action) (() => SoundEffectExtensions.Emit(this.treasureGetSound)));
   }
   if (!flag && this.treasureIsMap)
   {
     this.treasureOrigin = this.aoOrigin - new Vector3(0.0f, 0.125f, 0.0f);
     string treasureMapName = this.treasureAoInstance.ActorSettings.TreasureMapName;
     Texture2D texture2D1 = this.CMProvider.Global.Load<Texture2D>("Other Textures/maps/" + treasureMapName + "_1");
     Texture2D texture2D2 = this.CMProvider.Global.Load<Texture2D>("Other Textures/maps/" + treasureMapName + "_2");
     for (int index = 0; index < this.map.Groups.Count; ++index)
       this.map.Groups[index].Texture = index % 2 == 0 ? (Texture) texture2D1 : (Texture) texture2D2;
     Mesh mesh = Enumerable.First<Mesh>((IEnumerable<Mesh>) this.FloatingMaps, (Func<Mesh, bool>) (x => ((OpenTreasure.TreasureActorSettings) x.CustomData).AoInstance == this.treasureAoInstance));
     this.map.Position = mesh.Position - FezMath.ForwardVector(this.CameraManager.Viewpoint) * 0.5f;
     this.map.Rotation = mesh.Rotation;
     this.FloatingMaps.Remove(mesh);
   }
   this.oldGround = (TrileInstance) null;
   if (this.PlayerManager.Grounded)
   {
     this.oldGround = this.PlayerManager.Ground.First;
     this.oldGroundHeight = this.PlayerManager.Ground.First.Center.Y;
   }
   this.SoundManager.FadeVolume(1f, 0.125f, 2f);
 }
コード例 #13
0
ファイル: OpenTreasure.cs プロジェクト: tanis2000/FEZ
 protected override void TestConditions()
 {
   if (this.PlayerManager.Action == ActionType.OpeningTreasure || this.PlayerManager.Action == ActionType.FindingTreasure || (this.PlayerManager.Action == ActionType.ReadingSign || this.PlayerManager.Action == ActionType.FreeFalling) || (this.PlayerManager.Action == ActionType.Dying || this.GameState.InFpsMode))
     return;
   TrileInstance trileInstance = this.PlayerManager.AxisCollision[VerticalDirection.Up].Surface;
   if (trileInstance != null && !trileInstance.Hidden && ActorTypeExtensions.IsTreasure(trileInstance.Trile.ActorSettings.Type))
   {
     this.treasureIsMap = this.treasureIsAo = false;
     this.treasureIsAo = false;
     this.chestAO = (ArtObjectInstance) null;
     this.treasureInstance = trileInstance;
     this.treasureTrile = trileInstance.Trile;
     this.treasureActorType = this.treasureTrile.ActorSettings.Type;
     this.PlayerManager.Action = ActionType.FindingTreasure;
     this.sinceCollect = TimeSpan.Zero;
     this.oldDepth = FezMath.Dot(this.PlayerManager.Position, FezMath.DepthMask(this.CameraManager.Viewpoint));
     this.PlayerManager.Position = this.PlayerManager.Position * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) + this.treasureInstance.Position * FezMath.DepthMask(this.CameraManager.Viewpoint) + 2f * -FezMath.ForwardVector(this.CameraManager.Viewpoint);
   }
   else
   {
     foreach (Mesh mesh in this.FloatingMaps)
     {
       Vector3 vector3_1 = new Vector3(0.75f);
       Vector3 a = FezMath.Abs(mesh.Position - this.PlayerManager.Center);
       if ((double) FezMath.Dot(a, FezMath.SideMask(this.CameraManager.Viewpoint)) < (double) vector3_1.X && (double) a.Y < (double) vector3_1.Y)
       {
         Vector3 b = FezMath.ForwardVector(this.CameraManager.Viewpoint);
         NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.Position);
         if (nearestTriles.Deep != null)
         {
           Vector3 vector3_2 = nearestTriles.Deep.Center - nearestTriles.Deep.TransformedSize * b / 2f;
           if ((double) FezMath.Dot(mesh.Position - b - vector3_2, b) > 0.0)
             continue;
         }
         this.treasureIsMap = true;
         this.treasureIsAo = false;
         this.chestAO = (ArtObjectInstance) null;
         this.treasureAo = ((OpenTreasure.TreasureActorSettings) mesh.CustomData).ArtObject;
         this.treasureAoInstance = ((OpenTreasure.TreasureActorSettings) mesh.CustomData).AoInstance;
         this.treasureActorType = this.treasureAo.ActorType;
         this.PlayerManager.Action = ActionType.FindingTreasure;
         this.sinceCollect = TimeSpan.Zero;
         this.oldDepth = FezMath.Dot(this.PlayerManager.Position, FezMath.DepthMask(this.CameraManager.Viewpoint));
         this.PlayerManager.Position = this.PlayerManager.Position * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) + mesh.Position * FezMath.DepthMask(this.CameraManager.Viewpoint) + 2f * -FezMath.ForwardVector(this.CameraManager.Viewpoint);
         return;
       }
     }
     if (!this.PlayerManager.Grounded || this.PlayerManager.Background)
       return;
     this.chestAO = (ArtObjectInstance) null;
     foreach (ArtObjectInstance artObjectInstance in this.LevelChests)
     {
       if (artObjectInstance.Visible && !artObjectInstance.ActorSettings.Inactive)
       {
         Vector3 vector3_1 = artObjectInstance.ArtObject.Size / 2f;
         Vector3 a = FezMath.Abs(artObjectInstance.Position - this.PlayerManager.Center);
         if ((double) FezMath.Dot(a, FezMath.SideMask(this.CameraManager.Viewpoint)) < (double) vector3_1.X && (double) a.Y < (double) vector3_1.Y)
         {
           Vector3 b = FezMath.ForwardVector(this.CameraManager.Viewpoint);
           NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.Position);
           if (nearestTriles.Deep != null)
           {
             Vector3 vector3_2 = nearestTriles.Deep.Center - nearestTriles.Deep.TransformedSize * b / 2f;
             if ((double) FezMath.Dot(artObjectInstance.Position - b - vector3_2, b) > 0.0)
               continue;
           }
           if (FezMath.AsViewpoint(FezMath.OrientationFromDirection(FezMath.AlmostClamp(Vector3.Transform(Vector3.UnitZ, artObjectInstance.Rotation)))) == this.CameraManager.Viewpoint)
           {
             this.chestAO = artObjectInstance;
             this.sinceCollect = TimeSpan.Zero;
             break;
           }
         }
       }
     }
     if (this.chestAO == null || this.InputManager.GrabThrow != FezButtonState.Pressed)
       return;
     this.GomezService.OnOpenTreasure();
     Volume volume;
     if ((volume = Enumerable.FirstOrDefault<Volume>((IEnumerable<Volume>) this.PlayerManager.CurrentVolumes, (Func<Volume, bool>) (x =>
     {
       if (x.ActorSettings != null && x.ActorSettings.IsPointOfInterest)
         return (double) Vector3.DistanceSquared(FezMath.GetCenter(x.BoundingBox), this.chestAO.Position) < 2.0;
       else
         return false;
     }))) != null)
     {
       volume.Enabled = false;
       this.GameState.SaveData.ThisLevel.InactiveVolumes.Add(volume.Id);
     }
     this.PlayerManager.Action = ActionType.OpeningTreasure;
   }
 }
コード例 #14
0
ファイル: TrileInstance.cs プロジェクト: tanis2000/FEZ
 public void RefreshTrile()
 {
   this.Trile = TrileInstance.LevelManager.SafeGetTrile(this.TrileId);
   if (this.VisualTrileId.HasValue)
     this.VisualTrile = TrileInstance.LevelManager.SafeGetTrile(this.VisualTrileId.Value);
   else
     this.VisualTrile = this.Trile;
 }
コード例 #15
0
ファイル: LevelMaterializer.cs プロジェクト: tanis2000/FEZ
 public TrileMaterializer GetTrileMaterializer(Trile trile)
 {
   TrileMaterializer trileMaterializer;
   if (trile.Id < 0)
     trileMaterializer = this.fallbackMaterializer;
   else if (!this.trileMaterializers.TryGetValue(trile, out trileMaterializer))
     trileMaterializer = (TrileMaterializer) null;
   return trileMaterializer;
 }
コード例 #16
0
ファイル: TrileButtonWidget.cs プロジェクト: Gyoo/FEZMod
 public TrileButtonWidget(Game game, Trile trile)
     : base(game)
 {
     Trile = trile;
     Widgets.Add(Tooltip = new ButtonWidget(game));
 }
コード例 #17
0
ファイル: LevelMaterializer.cs プロジェクト: tanis2000/FEZ
 public virtual void RebuildTrile(Trile trile)
 {
   TrileMaterializer trileMaterializer = new TrileMaterializer(trile, this.TrilesMesh);
   this.trileMaterializers.Add(trile, trileMaterializer);
   trileMaterializer.Rebuild();
 }
コード例 #18
0
ファイル: TrileMaterializer.cs プロジェクト: Zeludon/FEZ
 public TrileMaterializer(Trile trile, Mesh levelMesh, bool mutableSurfaces)
 {
   ServiceHelper.InjectServices((object) this);
   this.trile = trile;
   if (mutableSurfaces)
   {
     this.surfaces = new List<TrixelSurface>();
     this.added = new HashSet<TrixelFace>();
     this.removed = new HashSet<TrixelFace>();
   }
   if (levelMesh == null)
     return;
   this.group = levelMesh.AddGroup();
   this.tempInstances = new List<Vector4>();
   this.tempInstanceIds = new List<TrileInstance>();
   this.group.Geometry = (IIndexedPrimitiveCollection) this.geometry;
 }
コード例 #19
0
ファイル: Trile.cs プロジェクト: tanis2000/FEZ
 public void CopyFrom(Trile copy)
 {
   this.ActorSettings = new TrileActorSettings(copy.ActorSettings);
   this.Faces = new Dictionary<FaceOrientation, CollisionType>((IDictionary<FaceOrientation, CollisionType>) copy.Faces);
   this.Immaterial = copy.Immaterial;
   this.Thin = copy.Thin;
   this.Name = copy.Name;
   this.ForceHugging = copy.ForceHugging;
   this.SeeThrough = copy.SeeThrough;
   this.SurfaceType = copy.SurfaceType;
 }
コード例 #20
0
 public BackgroundTrileMaterializer(Trile trile, Mesh levelMesh)
   : base(trile, levelMesh)
 {
 }
コード例 #21
0
ファイル: TempleOfLoveHost.cs プロジェクト: tanis2000/FEZ
 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;
 }