public override BaseEffect Clone() { DefaultEffect.Textured textured = new DefaultEffect.Textured(); textured.Fullbright = this.Fullbright; textured.Emissive = this.Emissive; textured.AlphaIsEmissive = this.AlphaIsEmissive; return((BaseEffect)textured); }
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); }
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(); }
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(); } }
public override void Initialize() { base.Initialize(); NowLoadingHexahedron.Phase = NowLoadingHexahedron.Phases.VectorOutline; TimeSpan timeSpan; NowLoadingHexahedron.SinceTurning = timeSpan = TimeSpan.Zero; NowLoadingHexahedron.SinceWavesStarted = timeSpan; NowLoadingHexahedron.SincePhaseStarted = timeSpan; this.PlayerManager.CanControl = false; this.WarpSound = this.CMProvider.GetForLevel(this.GameState.IsTrialMode ? "trial/ELDERS" : "ELDERS").Load<SoundEffect>("Sounds/Zu/HexaWarpIn"); this.Dot.Hidden = false; this.Dot.Behaviour = DotHost.BehaviourType.ClampToTarget; this.Dot.Target = this.Center; this.Dot.ScalePulsing = 0.0f; this.Dot.Opacity = 0.0f; Waiters.Wait((Func<bool>) (() => this.PlayerManager.Grounded), (Action) (() => { this.WalkTo.Destination = (Func<Vector3>) (() => this.PlayerManager.Position * Vector3.UnitY + this.Center * FezMath.XZMask); this.WalkTo.NextAction = ActionType.Idle; this.PlayerManager.Action = ActionType.WalkingTo; })); this.TimeManager.TimeFactor = this.TimeManager.DefaultTimeFactor; NowLoadingHexahedron loadingHexahedron1 = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored(); vertexColored1.Fullbright = true; vertexColored1.AlphaIsEmissive = false; DefaultEffect.VertexColored vertexColored2 = vertexColored1; mesh2.Effect = (BaseEffect) vertexColored2; mesh1.DepthWrites = false; mesh1.AlwaysOnTop = true; Mesh mesh3 = mesh1; loadingHexahedron1.Outline = mesh3; this.Outline.AddWireframePolygon(Color.White, new Vector3(0.0f, 0.8660254f, 0.0f), new Vector3(0.7071068f, 0.2886752f, 0.0f), new Vector3(0.7071068f, -0.2886752f, 0.0f), new Vector3(0.0f, -0.8660254f, 0.0f), new Vector3(-0.7071068f, -0.2886752f, 0.0f), new Vector3(-0.7071068f, 0.2886752f, 0.0f), new Vector3(0.0f, 0.8660254f, 0.0f)); this.Outline.Scale = new Vector3(4f); this.Outline.BakeTransform<FezVertexPositionColor>(); Group firstGroup = this.Outline.FirstGroup; firstGroup.Material = new Material(); firstGroup.Enabled = false; for (int index = 0; index < 1024; ++index) this.Outline.CloneGroup(firstGroup); firstGroup.Enabled = true; NowLoadingHexahedron loadingHexahedron2 = this; Mesh mesh4 = new Mesh(); Mesh mesh5 = mesh4; DefaultEffect.VertexColored vertexColored3 = new DefaultEffect.VertexColored(); vertexColored3.Fullbright = true; vertexColored3.AlphaIsEmissive = false; DefaultEffect.VertexColored vertexColored4 = vertexColored3; mesh5.Effect = (BaseEffect) vertexColored4; mesh4.DepthWrites = false; mesh4.AlwaysOnTop = true; mesh4.Material.Opacity = 0.0f; Mesh mesh6 = mesh4; loadingHexahedron2.WireCube = mesh6; this.WireCube.AddWireframeBox(Vector3.One * 4f, Vector3.Zero, Color.White, true); this.WireCube.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float) Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f); this.WireCube.BakeTransform<FezVertexPositionColor>(); NowLoadingHexahedron loadingHexahedron3 = this; Mesh mesh7 = new Mesh(); Mesh mesh8 = mesh7; DefaultEffect.LitVertexColored litVertexColored1 = new DefaultEffect.LitVertexColored(); litVertexColored1.Fullbright = false; litVertexColored1.AlphaIsEmissive = false; DefaultEffect.LitVertexColored litVertexColored2 = litVertexColored1; mesh8.Effect = (BaseEffect) litVertexColored2; mesh7.AlwaysOnTop = true; mesh7.Material.Opacity = 0.0f; Mesh mesh9 = mesh7; loadingHexahedron3.SolidCube = mesh9; this.SolidCube.AddFlatShadedBox(Vector3.One * 4f, Vector3.Zero, Color.White, true); this.SolidCube.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float) Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f); this.SolidCube.BakeTransform<VertexPositionNormalColor>(); NowLoadingHexahedron loadingHexahedron4 = this; Mesh mesh10 = new Mesh(); Mesh mesh11 = mesh10; DefaultEffect.Textured textured1 = new DefaultEffect.Textured(); textured1.Fullbright = true; textured1.AlphaIsEmissive = false; DefaultEffect.Textured textured2 = textured1; mesh11.Effect = (BaseEffect) textured2; mesh10.DepthWrites = false; mesh10.Material.Opacity = 0.0f; mesh10.Blending = new BlendingMode?(BlendingMode.Alphablending); mesh10.SamplerState = SamplerState.LinearClamp; Mesh mesh12 = mesh10; loadingHexahedron4.Flare = mesh12; this.Flare.AddFace(Vector3.One * 4f, Vector3.Zero, FaceOrientation.Front, true); this.Flare.Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/flare_alpha")); this.Rays = 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 }; for (int index = 0; index < 128; ++index) { float x = 0.75f; float num = 0.0075f; Group group = this.Rays.AddGroup(); group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<FezVertexPositionTexture>(new FezVertexPositionTexture[6] { new FezVertexPositionTexture(new Vector3(0.0f, (float) ((double) num / 2.0 * 0.100000001490116), 0.0f), new Vector2(0.0f, 0.0f)), new FezVertexPositionTexture(new Vector3(x, num / 2f, 0.0f), new Vector2(1f, 0.0f)), new FezVertexPositionTexture(new Vector3(x, (float) ((double) num / 2.0 * 0.100000001490116), 0.0f), new Vector2(1f, 0.45f)), new FezVertexPositionTexture(new Vector3(x, (float) (-(double) num / 2.0 * 0.100000001490116), 0.0f), new Vector2(1f, 0.55f)), new FezVertexPositionTexture(new Vector3(x, (float) (-(double) num / 2.0), 0.0f), new Vector2(1f, 1f)), new FezVertexPositionTexture(new Vector3(0.0f, (float) (-(double) num / 2.0 * 0.100000001490116), 0.0f), new Vector2(0.0f, 1f)) }, new int[12] { 0, 1, 2, 0, 2, 5, 5, 2, 3, 5, 3, 4 }, PrimitiveType.TriangleList); group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Forward, RandomHelper.Between(0.0, 6.28318548202515)); group.Material = new Material() { Diffuse = new Vector3(0.0f) }; } ServiceHelper.AddComponent((IGameComponent) (this.TheDarkening = new NowLoadingHexahedron.Darkener(this.Game))); this.LevelManager.LevelChanged += new Action(this.Kill); SoundEffectExtensions.Emit(this.WarpSound).Persistent = true; }
private void TryInitialize() { if (this.eIdleSpin != null && this.eIdleSpin.Cue != null && (!this.eIdleSpin.Cue.IsDisposed && this.eIdleSpin.Cue.State != SoundState.Stopped)) this.eIdleSpin.Cue.Stop(false); this.eIdleSpin = (SoundEmitter) null; this.rgbPlanes = (Mesh) null; this.particles = (PlaneParticleSystem) null; this.Phase = LesserWarp.Phases.None; this.sinceInitialized = 0.0f; this.GateAo = Enumerable.FirstOrDefault<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObject.ActorType == ActorType.LesserGate)); if (this.GateAo == null) return; this.InitializeRgbGate(); LesserWarp lesserWarp = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.Textured textured1 = new DefaultEffect.Textured(); textured1.Fullbright = true; DefaultEffect.Textured textured2 = textured1; mesh2.Effect = (BaseEffect) textured2; mesh1.DepthWrites = false; mesh1.Texture = (Dirtyable<Texture>) ((Texture) this.WhiteTexture); mesh1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, -1.570796f); Mesh mesh3 = mesh1; lesserWarp.MaskMesh = mesh3; this.MaskMesh.AddFace(new Vector3(2f), Vector3.Zero, FaceOrientation.Front, true, true); this.MaskMesh.BakeTransformWithNormal<FezVertexPositionNormalTexture>(); this.MaskMesh.Position = this.GateAo.Position - Vector3.UnitY * 1.25f; this.HasCubeShard = Enumerable.Any<TrileInstance>((IEnumerable<TrileInstance>) this.LevelManager.Triles.Values, (Func<TrileInstance, bool>) (x => { if (ActorTypeExtensions.IsCubeShard(x.Trile.ActorSettings.Type)) return (double) Vector3.Distance(x.Center, this.GateAo.Position) < 3.0; else return false; })); this.OriginalPosition = this.GateAo.Position; this.sRise = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpRise"); this.sLower = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpLower"); this.sActivate = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/WarpGateActivate"); this.eIdleSpin = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpIdleSpin"), this.GateAo.Position, true, true); }
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 }; }
public override void Initialize() { base.Initialize(); if (!this.IsArtObject) this.LevelMaterializer.CullInstanceOut(this.TrileInstance); this.SpawnMesh = new Mesh() { SamplerState = SamplerState.PointClamp, DepthWrites = false, Effect = (BaseEffect) new CubemappedEffect() }; IIndexedPrimitiveCollection primitiveCollection; if (this.IsArtObject) { ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Matrix> geometry = this.AoInstance.ArtObject.Geometry; primitiveCollection = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType); this.AoInstance.Material = new Material(); } else { ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry = this.TrileInstance.Trile.Geometry; primitiveCollection = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType); } Group group = this.SpawnMesh.AddGroup(); group.Geometry = primitiveCollection; group.Rotation = this.IsArtObject ? this.AoInstance.Rotation : Quaternion.CreateFromAxisAngle(Vector3.UnitY, this.TrileInstance.Phi); if (!this.IsArtObject) { group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, this.TrileInstance.Phi); if (this.TrileInstance.Trile.ActorSettings.Type == ActorType.CubeShard || this.TrileInstance.Trile.ActorSettings.Type == ActorType.SecretCube || this.TrileInstance.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.SpawnMesh.Position = this.IsArtObject ? this.AoInstance.Position : this.TrileInstance.Center; this.StarsTexture = this.CMProvider.Global.Load<Texture2D>("Other Textures/black_hole/Stars"); GlitchyDespawner glitchyDespawner = this; DefaultEffect.Textured textured1 = new DefaultEffect.Textured(); textured1.Fullbright = true; DefaultEffect.Textured textured2 = textured1; glitchyDespawner.FullbrightEffect = (DefaultEffect) textured2; SoundEffectExtensions.EmitAt(this.CMProvider.Global.Load<SoundEffect>("Sounds/MiscActors/GlitchyRespawn"), this.SpawnMesh.Position); this.LightingPostProcess.DrawOnTopLights += new Action(this.DrawLights); this.LevelManager.LevelChanging += new Action(this.Kill); }
private void TryInitialize() { this.ThisLevelMesh.ClearGroups(); this.NextLevelMesh.ClearGroups(); lock (FarawayPlaceHost.FarawayWaterMutex) this.FarawayWaterMesh = (Mesh) null; (this.NextLevelMesh.Effect as FarawayEffect).CleanUp(); foreach (Script script1 in Enumerable.Where<Script>((IEnumerable<Script>) this.LevelManager.Scripts.Values, (Func<Script, bool>) (x => Enumerable.Any<ScriptAction>((IEnumerable<ScriptAction>) x.Actions, (Func<ScriptAction, bool>) (y => y.Operation == "ChangeToFarAwayLevel"))))) { Volume volume1; if (this.LevelManager.Volumes.TryGetValue(Enumerable.FirstOrDefault<ScriptTrigger>((IEnumerable<ScriptTrigger>) script1.Triggers, (Func<ScriptTrigger, bool>) (x => { if (x.Object.Type == "Volume") return x.Event == "Enter"; else return false; })).Object.Identifier.Value, out volume1)) { FaceOrientation faceOrientation = Enumerable.FirstOrDefault<FaceOrientation>((IEnumerable<FaceOrientation>) volume1.Orientations); ScriptAction scriptAction1 = Enumerable.FirstOrDefault<ScriptAction>((IEnumerable<ScriptAction>) script1.Actions, (Func<ScriptAction, bool>) (x => x.Operation == "ChangeToFarAwayLevel")); string str1 = scriptAction1.Arguments[0]; int num1 = 0; string songName; FaceOrientation orientation; Vector2 vector2; bool flag; float num2; float num3; float num4; using (MemoryContentManager memoryContentManager = new MemoryContentManager((IServiceProvider) this.Game.Services, this.Game.Content.RootDirectory)) { string str2 = str1; if (!MemoryContentManager.AssetExists("Levels" + (object) '\\' + str1.Replace('/', '\\'))) str2 = this.LevelManager.FullPath.Substring(0, this.LevelManager.FullPath.LastIndexOf("/") + 1) + str1.Substring(str1.LastIndexOf("/") + 1); LevelReader.MinimalRead = true; Level level; try { level = memoryContentManager.Load<Level>("Levels/" + str2); } catch (Exception ex) { Logger.Log("FarawayPlaceHost", Common.LogSeverity.Warning, "Couldn't load faraway place destination level : " + str1); continue; } LevelReader.MinimalRead = false; songName = level.SongName; int key; try { key = int.Parse(scriptAction1.Arguments[1]); } catch (Exception ex) { key = -1; } Volume volume2 = key == -1 || !level.Volumes.ContainsKey(key) ? level.Volumes[Enumerable.First<ScriptTrigger>((IEnumerable<ScriptTrigger>) Enumerable.First<Script>((IEnumerable<Script>) level.Scripts.Values, (Func<Script, bool>) (s => Enumerable.Any<ScriptAction>((IEnumerable<ScriptAction>) s.Actions, (Func<ScriptAction, bool>) (a => { if (a.Object.Type == "Level" && a.Operation.Contains("Level")) return a.Arguments[0] == this.LevelManager.Name; else return false; })))).Triggers, (Func<ScriptTrigger, bool>) (t => { if (t.Object.Type == "Volume") return t.Event == "Enter"; else return false; })).Object.Identifier.Value] : level.Volumes[key]; orientation = Enumerable.FirstOrDefault<FaceOrientation>((IEnumerable<FaceOrientation>) volume2.Orientations); Vector3 vector3 = (level.Size / 2f - (volume2.From + volume2.To) / 2f) * (FezMath.RightVector(FezMath.AsViewpoint(orientation)) + Vector3.Up); vector2 = new Vector2(vector3.X + vector3.Z, vector3.Y); flag = level.WaterType != LiquidType.None; num2 = level.WaterHeight - (volume2.From + volume2.To).Y / 2f + this.EngineState.WaterLevelOffset; num3 = this.LevelManager.WaterHeight - (volume1.From + volume1.To).Y / 2f - num2 / 4f; num4 = level.Size.Y; Script script2 = Enumerable.FirstOrDefault<Script>((IEnumerable<Script>) level.Scripts.Values, (Func<Script, bool>) (s => { if (Enumerable.Any<ScriptTrigger>((IEnumerable<ScriptTrigger>) s.Triggers, (Func<ScriptTrigger, bool>) (t => { if (t.Event == "Start") return t.Object.Type == "Level"; else return false; }))) return Enumerable.Any<ScriptAction>((IEnumerable<ScriptAction>) s.Actions, (Func<ScriptAction, bool>) (a => { if (a.Object.Type == "Camera") return a.Operation == "SetPixelsPerTrixel"; else return false; })); else return false; })); if (script2 != null) { ScriptAction scriptAction2 = Enumerable.First<ScriptAction>((IEnumerable<ScriptAction>) script2.Actions, (Func<ScriptAction, bool>) (a => { if (a.Object.Type == "Camera") return a.Operation == "SetPixelsPerTrixel"; else return false; })); try { num1 = int.Parse(scriptAction2.Arguments[0]); } catch (Exception ex) { } } num2 = level.WaterHeight; } Texture2D texture; try { string assetName = "Other Textures/faraway_thumbs/" + (object) str1 + " (" + (string) (object) FezMath.AsViewpoint(orientation) + ")"; texture = this.CMProvider.CurrentLevel.Load<Texture2D>(assetName); texture.Name = assetName; } catch (Exception ex) { Logger.Log("FarawayPlacesHost", Common.LogSeverity.Warning, "Couldn't load faraway thumbnail for " + (object) str1 + " (viewpoint = " + (string) (object) FezMath.AsViewpoint(orientation) + ")"); continue; } if (!Enumerable.Any<Group>((IEnumerable<Group>) this.ThisLevelMesh.Groups, (Func<Group, bool>) (x => x.Texture == texture))) { if (num1 == 0) num1 = (int) this.CameraManager.PixelsPerTrixel; Group group1 = this.ThisLevelMesh.AddFace(new Vector3((float) texture.Width, (float) texture.Height, (float) texture.Width) / 16f / 2f, Vector3.Zero, faceOrientation, true); Group group2 = this.NextLevelMesh.AddFace(new Vector3((float) texture.Width, (float) texture.Height, (float) texture.Width) / 16f / 2f, Vector3.Zero, faceOrientation, true); FarawayPlaceData farawayPlaceData = new FarawayPlaceData() { OriginalCenter = (volume1.From + volume1.To) / 2f, Viewpoint = FezMath.AsViewpoint(faceOrientation), Volume = volume1, DestinationOffset = vector2.X * FezMath.RightVector(FezMath.AsViewpoint(faceOrientation)) + Vector3.Up * vector2.Y, WaterLevelOffset = new float?(num3), DestinationLevelName = str1, DestinationWaterLevel = num2, DestinationLevelSize = num4 }; if (this.LevelManager.WaterType == LiquidType.None && flag) { if (this.HorizontalGradientTex == null || this.HorizontalGradientTex.IsDisposed) this.HorizontalGradientTex = this.CMProvider.Global.Load<Texture2D>("Other Textures/WaterHorizGradient"); lock (FarawayPlaceHost.FarawayWaterMutex) { FarawayPlaceHost temp_380 = this; // ISSUE: explicit reference operation // ISSUE: variable of a reference type FarawayPlaceData& temp_381 = @farawayPlaceData; Mesh local_28 = new Mesh(); Mesh temp_383 = local_28; DefaultEffect.Textured local_29 = new DefaultEffect.Textured(); local_29.AlphaIsEmissive = false; DefaultEffect.Textured temp_387 = local_29; temp_383.Effect = (BaseEffect) temp_387; Mesh temp_388; Mesh local_43 = temp_388 = local_28; // ISSUE: explicit reference operation (^temp_381).WaterBodyMesh = temp_388; Mesh temp_389 = local_43; temp_380.FarawayWaterMesh = temp_389; this.FarawayWaterMesh.AddFace(Vector3.One, new Vector3(-0.5f, -1f, -0.5f) + FezMath.Abs(FezMath.AsVector(faceOrientation)) * 0.5f, faceOrientation, false).Material = new Material(); this.FarawayWaterMesh.AddFace(Vector3.One, new Vector3(-0.5f, -1f, -0.5f) + FezMath.Abs(FezMath.AsVector(faceOrientation)) * 0.5f, faceOrientation, false).Material = new Material(); } } group2.CustomData = group1.CustomData = (object) farawayPlaceData; group2.Position = group1.Position = farawayPlaceData.OriginalCenter; group2.Texture = group1.Texture = (Texture) texture; group2.Material = new Material() { Opacity = 0.125f }; group1.Material = new Material() { Opacity = 0.125f }; if (volume1.ActorSettings == null) volume1.ActorSettings = new VolumeActorSettings(); volume1.ActorSettings.DestinationSong = songName; switch (num1) { case 1: volume1.ActorSettings.DestinationRadius = 80f; break; case 2: volume1.ActorSettings.DestinationRadius = 40f; break; case 3: volume1.ActorSettings.DestinationRadius = 26.66667f; break; case 4: volume1.ActorSettings.DestinationRadius = 20f; break; case 5: volume1.ActorSettings.DestinationRadius = 16f; break; } volume1.ActorSettings.DestinationPixelsPerTrixel = (float) num1; volume1.ActorSettings.DestinationOffset = vector2; } } } }
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; } }); }
public override BaseEffect Clone() { DefaultEffect.Textured textured = new DefaultEffect.Textured(); textured.Fullbright = this.Fullbright; textured.Emissive = this.Emissive; textured.AlphaIsEmissive = this.AlphaIsEmissive; return (BaseEffect) textured; }
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); }
protected override void LoadContent() { this.SpriteBatch = new SpriteBatch(this.GraphicsDevice); this.tr = new GlyphTextRenderer(this.Game); ContentManager contentManager = this.CMProvider.Get(CM.Menu); this.PointerCursor = contentManager.Load<Texture2D>("Other Textures/cursor/CURSOR_POINTER"); this.CanClickCursor = contentManager.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_A"); this.ClickedCursor = contentManager.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_B"); this.sAdvanceLevel = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/AdvanceLevel"); this.sCancel = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Cancel"); this.sConfirm = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Confirm"); this.sCursorUp = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/CursorUp"); this.sCursorDown = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/CursorDown"); this.sExitGame = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/Menu/ExitGame"); this.sReturnLevel = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ReturnLevel"); this.sScreenNarrowen = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ScreenNarrowen"); this.sScreenWiden = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ScreenWiden"); this.sSliderValueDecrease = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/SliderValueDecrease"); this.sSliderValueIncrease = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/SliderValueIncrease"); this.sStartGame = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/Menu/StartGame"); this.sAppear = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Appear"); this.sDisappear = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/Menu/Disappear"); this.LeaderboardsMenu.InputManager = this.InputManager; this.LeaderboardsMenu.GameState = this.GameState; this.LeaderboardsMenu.Font = this.Fonts.Big; this.LeaderboardsMenu.MouseState = this.MouseState; this.ControlsMenu.FontManager = this.Fonts; this.ControlsMenu.CMProvider = this.CMProvider; this.CreditsMenu.FontManager = this.Fonts; foreach (MenuLevel menuLevel in this.MenuLevels) { menuLevel.CMProvider = this.CMProvider; menuLevel.Initialize(); } MenuBase menuBase1 = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored(); vertexColored1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up)); vertexColored1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f)); DefaultEffect.VertexColored vertexColored2 = vertexColored1; mesh2.Effect = (BaseEffect) vertexColored2; mesh1.DepthWrites = false; mesh1.AlwaysOnTop = true; mesh1.Culling = CullMode.None; Mesh mesh3 = mesh1; menuBase1.Selector = mesh3; this.Selector.AddLines(new Color[4] { Color.White, Color.White, Color.White, Color.White }, new Vector3(-1f, -1f, 10f), new Vector3(-1f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(1f, -1f, 10f)); this.Selector.AddLines(new Color[4] { Color.White, Color.White, Color.White, Color.White }, new Vector3(-1f, 1f, 10f), new Vector3(0.0f, 1f, 10f), new Vector3(-1f, -1f, 10f), new Vector3(0.0f, -1f, 10f)); this.Selector.AddLines(new Color[4] { Color.White, Color.White, Color.White, Color.White }, new Vector3(0.0f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(0.0f, -1f, 10f), new Vector3(1f, -1f, 10f)); MenuBase menuBase2 = this; Mesh mesh4 = new Mesh(); Mesh mesh5 = mesh4; DefaultEffect.VertexColored vertexColored3 = new DefaultEffect.VertexColored(); vertexColored3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up)); vertexColored3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f)); DefaultEffect.VertexColored vertexColored4 = vertexColored3; mesh5.Effect = (BaseEffect) vertexColored4; mesh4.DepthWrites = false; mesh4.AlwaysOnTop = true; mesh4.Culling = CullMode.None; mesh4.Enabled = false; Mesh mesh6 = mesh4; menuBase2.Frame = mesh6; this.Frame.AddLines(new Color[8] { Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White, Color.White }, new Vector3(-1f, -1f, 10f), new Vector3(-1f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(1f, -1f, 10f), new Vector3(-1f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(-1f, -1f, 10f), new Vector3(1f, -1f, 10f)); MenuBase menuBase3 = this; Mesh mesh7 = new Mesh(); Mesh mesh8 = mesh7; DefaultEffect.Textured textured1 = new DefaultEffect.Textured(); textured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up)); textured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f)); DefaultEffect.Textured textured2 = textured1; mesh8.Effect = (BaseEffect) textured2; mesh7.DepthWrites = false; mesh7.AlwaysOnTop = true; mesh7.SamplerState = SamplerState.PointClamp; Mesh mesh9 = mesh7; menuBase3.MenuLevelOverlay = mesh9; this.MenuLevelOverlay.AddFace(new Vector3(2f, 2f, 1f), new Vector3(0.0f, 0.0f, 10f), FaceOrientation.Back, true); MenuBase menuBase4 = this; Mesh mesh10 = new Mesh(); Mesh mesh11 = mesh10; DefaultEffect.Textured textured3 = new DefaultEffect.Textured(); textured3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up)); textured3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f)); DefaultEffect.Textured textured4 = textured3; mesh11.Effect = (BaseEffect) textured4; mesh10.DepthWrites = false; mesh10.AlwaysOnTop = true; Mesh mesh12 = mesh10; menuBase4.Mask = mesh12; this.Mask.AddFace(new Vector3(2f, 2f, 1f), new Vector3(0.0f, 0.0f, 10f), FaceOrientation.Back, true); Waiters.Wait(0.0, new Action(this.Rescale)); this.RenderToTexture(); }
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); }