private void Clear() { this.MotherCubeAo = (ArtObjectInstance)null; this.DoCapture = false; this.TimeAccumulator = 0.0f; if (this.RaysMesh != null) { this.RaysMesh.Dispose(); } if (this.FlareMesh != null) { this.FlareMesh.Dispose(); } this.FlareMesh = this.RaysMesh = (Mesh)null; this.sRotationDrone = this.sWhiteOut = (SoundEffect)null; if (this.eRotationDrone == null || this.eRotationDrone.Dead) { return; } this.eRotationDrone.FadeOutAndDie(0.0f); }
public SpinBlockState(List <TrileInstance> triles, ArtObjectInstance aoInstance, SoundEffect soundEffect) { ServiceHelper.InjectServices((object)this); this.Triles = triles; this.ArtObject = aoInstance; this.OriginalPosition = this.ArtObject.Position; if (this.ArtObject.ActorSettings.OffCenter) { this.RotationOffset = this.ArtObject.ActorSettings.RotationCenter - this.ArtObject.Position; } if (this.ArtObject.ActorSettings.SpinView == Viewpoint.None) { this.ArtObject.ActorSettings.SpinView = Viewpoint.Front; } foreach (TrileInstance trileInstance in this.Triles) { trileInstance.Unsafe = true; } this.SoundEffect = soundEffect; this.SinceChanged -= TimeSpan.FromSeconds((double)this.ArtObject.ActorSettings.SpinOffset); this.IsRotato = this.ArtObject.ActorSettings.SpinView == Viewpoint.Up || this.ArtObject.ActorSettings.SpinView == Viewpoint.Down; }
private void TryInitialize() { this.sRumble = (SoundEffect)null; this.eRumble = (SoundEmitter)null; this.OwlHeadAo = Enumerable.SingleOrDefault <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x => { if (!(x.ArtObjectName == "OWL_STATUE_HEADAO") && !(x.ArtObjectName == "BIG_OWL_HEADAO")) { return(x.ArtObjectName == "OWL_STATUE_DRAPES_BAO"); } else { return(true); } })); this.AttachedCandlesAo = (ArtObjectInstance)null; this.IsBig = this.OwlHeadAo != null && this.OwlHeadAo.ArtObjectName == "BIG_OWL_HEADAO"; this.Enabled = this.OwlHeadAo != null; this.SinceStarted = 0.0f; if (!this.Enabled) { return; } this.sRumble = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/MiscActors/Rumble"); this.eRumble = SoundEffectExtensions.EmitAt(this.sRumble, this.OwlHeadAo.Position, true, true); this.eRumble.VolumeFactor = 0.0f; this.IsInverted = false; if (this.OwlHeadAo.ArtObjectName == "OWL_STATUE_DRAPES_BAO") { this.AttachedCandlesAo = this.LevelManager.ArtObjects[14]; this.OriginalRotation = Quaternion.Identity; this.IsInverted = true; } else { this.OriginalRotation = this.OwlHeadAo.Rotation * Quaternion.CreateFromAxisAngle(Vector3.Up, FezMath.ToPhi(this.CameraManager.Viewpoint)); } this.OriginalTranslation = this.OwlHeadAo.Position; }
public static GameObject GenObject(this ArtObjectInstance ao, GameObject parent = null) { GameObject obj = new GameObject(ao.ArtObject.Name); if (parent != null) { obj.transform.parent = parent.transform; } obj.transform.localPosition = ao.Position; obj.transform.rotation = ao.Rotation; obj.transform.localScale = ao.Scale; // Holder not required - nothing happens in Update // FezUnityArtObjectInstance fezHolder = obj.AddComponent<FezUnityArtObjectInstance>(); // fezHolder.Fill(ao); FezUnityArtObjectInstance.Fill(obj, ao); obj.isStatic = true; // Fix Unity / Trixel Engine Z direction conflict obj.FezZ(); return(obj); }
public BitDoorState(ArtObjectInstance artObject) { ServiceHelper.InjectServices((object)this); this.AoInstance = artObject; switch (artObject.ArtObject.ActorType) { case ActorType.FourBitDoor: case ActorType.TwoBitDoor: case ActorType.SixteenBitDoor: case ActorType.EightBitDoor: case ActorType.OneBitDoor: this.BitTexture = this.CMProvider.Global.Load <Texture2D>("Other Textures/glow/GLOWBIT"); this.AntiBitTexture = this.CMProvider.Global.Load <Texture2D>("Other Textures/glow/GLOWBIT_anti"); break; case ActorType.ThirtyTwoBitDoor: this.BitTexture = this.CMProvider.Global.Load <Texture2D>("Other Textures/glow/small_glowbit"); this.AntiBitTexture = this.CMProvider.Global.Load <Texture2D>("Other Textures/glow/small_glowbit_anti"); break; default: this.BitTexture = this.CMProvider.Global.Load <Texture2D>("Other Textures/glow/code_machine_glowbit"); this.AntiBitTexture = this.CMProvider.Global.Load <Texture2D>("Other Textures/glow/code_machine_glowbit_anti"); for (int index = 0; index < 64; ++index) { this.SixtyFourOffsets[index] /= 16f; } break; } this.RumbleSound = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/MiscActors/Rumble"); this.sLightUp = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/DoorBitLightUp"); this.sFadeOut = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/DoorBitFadeOut"); this.ExpectedViewpoint = FezMath.AsViewpoint(FezMath.OrientationFromDirection(FezMath.MaxClamp(Vector3.Transform(Vector3.UnitZ, this.AoInstance.Rotation)))); this.lastBits = 0; this.InitBitPlanes(); }
protected override void TestConditions() { if (!this.PlayerManager.Grounded) { this.UnDotize(); } else if (this.PlayerManager.CarriedInstance != null) { this.UnDotize(); } else { bool flag = false; foreach (NearestTriles nearestTriles in this.PlayerManager.AxisCollision.Values) { TrileInstance trileInstance = nearestTriles.Surface; if (trileInstance != null) { Trile trile = trileInstance.Trile; FaceOrientation faceOrientation = FezMath.OrientationFromPhi(FezMath.ToPhi(trile.ActorSettings.Face) + trileInstance.Phi); if (ActorTypeExtensions.IsDoor(trile.ActorSettings.Type) && faceOrientation == FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) { flag = this.GameState.SaveData.Keys > 0 && this.LevelManager.Name != "VILLAGEVILLE_2D" || trile.ActorSettings.Type == ActorType.UnlockedDoor; this.isUnlocked = trile.ActorSettings.Type == ActorType.UnlockedDoor; this.doorBottom = trileInstance; break; } } } if (!flag) { this.UnDotize(); } else if (this.doorBottom.ActorSettings.Inactive) { this.UnDotize(); } else { if (!this.PlayerManager.HideFez && this.PlayerManager.CanControl && (!this.DotManager.PreventPoI && this.doorBottom.Trile.ActorSettings.Type == ActorType.Door)) { this.DotManager.Behaviour = DotHost.BehaviourType.ThoughtBubble; this.DotManager.FaceButton = DotFaceButton.Up; this.DotManager.ComeOut(); if (this.DotManager.Owner != this) { this.DotManager.Hey(); } this.DotManager.Owner = (object)this; } if (this.GameState.IsTrialMode && this.LevelManager.Name == "trial/VILLAGEVILLE_2D" || this.InputManager.ExactUp != FezButtonState.Pressed) { return; } TrileGroup trileGroup1 = (TrileGroup)null; this.aoInstance = (ArtObjectInstance)null; foreach (TrileGroup trileGroup2 in (IEnumerable <TrileGroup>) this.LevelManager.Groups.Values) { if (trileGroup2.Triles.Contains(this.doorBottom)) { trileGroup1 = trileGroup2; break; } } if (trileGroup1 != null) { foreach (ArtObjectInstance artObjectInstance in (IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values) { int?attachedGroup = artObjectInstance.ActorSettings.AttachedGroup; int id = trileGroup1.Id; if ((attachedGroup.GetValueOrDefault() != id ? 0 : (attachedGroup.HasValue ? 1 : 0)) != 0) { this.aoInstance = artObjectInstance; break; } } if (this.aoInstance != null) { this.aoInitialRotation = this.aoInstance.Rotation; this.initialAoPosition = this.aoInstance.Position; } } this.WalkTo.Destination = new Func <Vector3>(this.GetDestination); this.PlayerManager.Action = ActionType.WalkingTo; this.WalkTo.NextAction = ActionType.OpeningDoor; } } }
private void TryInitialize() { this.Enabled = this.LevelManager.Name == "CLOCK"; this.RedAo = this.BlueAo = this.GreenAo = this.WhiteAo = (ArtObjectInstance)null; this.sTickTock = (SoundEffect)null; this.eTickTock = (SoundEmitter)null; if (!this.Enabled) { return; } foreach (ArtObjectInstance artObjectInstance in (IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values) { if (artObjectInstance.ArtObjectName == "CLOCKHAND_RAO") { this.RedAo = artObjectInstance; } if (artObjectInstance.ArtObjectName == "CLOCKHAND_GAO") { this.GreenAo = artObjectInstance; } if (artObjectInstance.ArtObjectName == "CLOCKHAND_BAO") { this.BlueAo = artObjectInstance; } if (artObjectInstance.ArtObjectName == "CLOCKHAND_WAO") { this.WhiteAo = artObjectInstance; } } this.RedOriginalRotation = this.RedAo.Rotation; this.BlueOriginalRotation = this.BlueAo.Rotation; this.GreenOriginalRotation = this.GreenAo.Rotation; this.WhiteOriginalRotation = this.WhiteAo.Rotation; this.RedOriginalPosition = this.RedAo.Position + 1.125f * Vector3.UnitX; this.GreenOriginalPosition = this.GreenAo.Position - 1.125f * Vector3.UnitX; this.BlueOriginalPosition = this.BlueAo.Position + 1.125f * Vector3.UnitZ; this.WhiteOriginalPosition = this.WhiteAo.Position - 1.125f * Vector3.UnitZ; this.RedGroup = this.LevelManager.Groups[23]; this.BlueGroup = this.LevelManager.Groups[24]; this.GreenGroup = this.LevelManager.Groups[25]; this.WhiteGroup = this.LevelManager.Groups[26]; this.RedTopMost = Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.RedGroup.Triles, (Func <TrileInstance, bool>)(x => x.Emplacement.Y == 58)); this.BlueTopMost = Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.BlueGroup.Triles, (Func <TrileInstance, bool>)(x => x.Emplacement.Y == 58)); this.GreenTopMost = Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.GreenGroup.Triles, (Func <TrileInstance, bool>)(x => x.Emplacement.Y == 58)); this.WhiteTopMost = Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.WhiteGroup.Triles, (Func <TrileInstance, bool>)(x => x.Emplacement.Y == 58)); if (this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.RedAo.Id)) { this.RedAo.Enabled = false; this.LevelManager.RemoveArtObject(this.RedAo); } if (this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.GreenAo.Id)) { this.GreenAo.Enabled = false; this.LevelManager.RemoveArtObject(this.GreenAo); } if (this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.BlueAo.Id)) { this.BlueAo.Enabled = false; this.LevelManager.RemoveArtObject(this.BlueAo); } if (this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.WhiteAo.Id)) { this.WhiteAo.Enabled = false; this.LevelManager.RemoveArtObject(this.WhiteAo); } TimeSpan timeSpan = TimeSpan.FromTicks((DateTime.UtcNow - DateTime.FromFileTimeUtc(this.GameState.SaveData.CreationTime)).Ticks); if (this.RedAo.Enabled) { float angle = FezMath.WrapAngle((float)((double)FezMath.Round(timeSpan.TotalSeconds) / 60.0 * 6.28318548202515)); this.lastRedAngle = angle; this.RedAo.Rotation = Quaternion.CreateFromAxisAngle(-Vector3.UnitZ, angle) * this.RedOriginalRotation; } if (!this.WhiteAo.Enabled && !this.BlueAo.Enabled && (!this.GreenAo.Enabled && !this.RedAo.Enabled)) { return; } this.sTickTock = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/MiscActors/TickTockLoop"); Waiters.Wait(FezMath.Frac(timeSpan.TotalSeconds), (Action)(() => this.eTickTock = SoundEffectExtensions.EmitAt(this.sTickTock, new Vector3(41.5f, 61.5f, 35.5f), true))); }
private void TryInitialize() { this.Enabled = false; this.ArtObject = Enumerable.FirstOrDefault <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x => { if (x.ArtObject.ActorType == ActorType.QrCode) { return(x.ActorSettings.VibrationPattern != null); } else { return(false); } })); if (this.ArtObject != null) { this.Enabled = true; if (this.GameService.IsSewerQrResolved) { if (this.ArtObject.ActorSettings.AttachedGroup.HasValue) { int key = this.ArtObject.ActorSettings.AttachedGroup.Value; foreach (TrileInstance instance in this.LevelManager.Groups[this.ArtObject.ActorSettings.AttachedGroup.Value].Triles.ToArray()) { this.LevelManager.ClearTrile(instance); } this.LevelManager.Groups.Remove(key); } this.LevelManager.Volumes[1].Enabled = false; this.LevelManager.ArtObjects.Remove(this.ArtObject.Id); this.ArtObject.Dispose(); this.LevelMaterializer.RegisterSatellites(); Vector3 position1 = this.ArtObject.Position; if (this.GameState.SaveData.ThisLevel.ScriptingState == "NOT_COLLECTED") { Trile trile = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube)); if (trile != null) { Vector3 position2 = position1 - Vector3.One / 2f; this.LevelManager.ClearTrile(new TrileEmplacement(position2)); TrileInstance toAdd; this.LevelManager.RestoreTrile(toAdd = new TrileInstance(position2, trile.Id) { OriginalEmplacement = new TrileEmplacement(position2) }); this.GomezService.CollectedAnti += (Action)(() => this.GameState.SaveData.ThisLevel.ScriptingState = (string)null); if (toAdd.InstanceId == -1) { this.LevelMaterializer.CullInstanceIn(toAdd); } } } this.Enabled = false; } } if (!this.Enabled) { return; } this.ArtObject.ActorSettings.VibrationPattern = Util.JoinArrays <VibrationMotor>(this.ArtObject.ActorSettings.VibrationPattern, new VibrationMotor[3]); }
private void TryInitialize() { this.DoorAo = (ArtObjectInstance)null; this.AttachedGroup = (TrileGroup)null; this.AssociatedVolume = (Volume)null; this.Enabled = false; this.sRumble = (SoundEffect)null; this.sLightUp = (SoundEffect)null; this.sFadeOut = (SoundEffect)null; if (this.eRumble != null && !this.eRumble.Dead) { this.eRumble.Cue.Stop(false); } this.eRumble = (SoundEmitter)null; foreach (ArtObjectInstance artObjectInstance in (IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values) { if (artObjectInstance.ArtObject.ActorType == ActorType.SecretPassage) { this.DoorAo = artObjectInstance; this.Enabled = true; break; } } if (!this.Enabled) { if (this.GlowPlane != null) { this.GlowPlane.Dispose(); } this.GlowPlane = (BackgroundPlane)null; } if (!this.Enabled) { return; } this.AttachedGroup = this.LevelManager.Groups[this.DoorAo.ActorSettings.AttachedGroup.Value]; this.AssociatedVolume = Enumerable.FirstOrDefault <Volume>((IEnumerable <Volume>) this.LevelManager.Volumes.Values, (Func <Volume, bool>)(x => { if (x.ActorSettings != null) { return(x.ActorSettings.IsSecretPassage); } else { return(false); } })); string key = (string)null; foreach (Script script in (IEnumerable <Script>) this.LevelManager.Scripts.Values) { foreach (ScriptAction scriptAction in script.Actions) { if (scriptAction.Object.Type == "Level" && scriptAction.Operation.Contains("Level")) { foreach (ScriptTrigger scriptTrigger in script.Triggers) { if (scriptTrigger.Object.Type == "Volume" && scriptTrigger.Event == "Enter" && scriptTrigger.Object.Identifier.HasValue) { key = scriptAction.Arguments[0]; } } } } } this.Accessible = this.GameState.SaveData.World.ContainsKey(key); this.sRumble = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/MiscActors/Rumble"); this.sLightUp = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/DoorBitLightUp"); this.sFadeOut = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/DoorBitFadeOut"); if (!this.Accessible) { this.Enabled = false; } else { this.GlowPlane = new BackgroundPlane(this.LevelMaterializer.StaticPlanesMesh, (Texture)this.CMProvider.CurrentLevel.Load <Texture2D>("Other Textures/glow/secret_passage")) { Fullbright = true, Opacity = 0.0f, Position = this.DoorAo.Position + FezMath.AsVector(Enumerable.First <FaceOrientation>((IEnumerable <FaceOrientation>) this.AssociatedVolume.Orientations)) / (65.0 / 32.0), Rotation = FezMath.QuaternionFromPhi(FezMath.ToPhi(Enumerable.First <FaceOrientation>((IEnumerable <FaceOrientation>) this.AssociatedVolume.Orientations))), AttachedGroup = new int?(this.AttachedGroup.Id) }; this.LevelManager.AddPlane(this.GlowPlane); this.ExpectedViewpoint = FezMath.AsViewpoint(Enumerable.First <FaceOrientation>((IEnumerable <FaceOrientation>) this.AssociatedVolume.Orientations)); if (!this.LevelManager.WentThroughSecretPassage) { return; } this.MoveUp = true; this.GlowPlane.Opacity = 1f; this.SinceStarted = TimeSpan.Zero; this.AoOrigin = this.DoorAo.Position; this.PlaneOrigin = this.GlowPlane.Position; } }
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))); }
public override void Draw(GameTime gameTime) { if (this.GameState.Loading) { return; } if ((double)this.SinceStarted > 19.0 && this.Rings != null) { this.AoVisibility.Clear(); foreach (ArtObjectInstance artObjectInstance in this.LevelMaterializer.LevelArtObjects) { this.AoVisibility.Add(artObjectInstance.Visible); artObjectInstance.Visible = false; artObjectInstance.ArtObject.Group.Enabled = false; } for (int index = 0; index < 4; ++index) { ArtObjectInstance artObjectInstance = this.Rings[index]; this.OriginalTextures[index] = artObjectInstance.ArtObject.Group.TextureMap; artObjectInstance.Visible = true; artObjectInstance.ArtObject.Group.Enabled = true; artObjectInstance.ArtObject.Group.Texture = (Texture)this.WhiteTex; artObjectInstance.Material.Opacity = Easing.EaseIn((double)FezMath.Saturate((float)(((double)this.SinceStarted - 19.0) / 18.0)), EasingType.Cubic); artObjectInstance.Update(); } this.LevelMaterializer.ArtObjectsMesh.Draw(); for (int index = 0; index < 4; ++index) { this.Rings[index].ArtObject.Group.Texture = (Texture)this.OriginalTextures[index]; this.OriginalTextures[index] = (Texture2D)null; this.Rings[index].Material.Opacity = 1f; } int num = 0; foreach (ArtObjectInstance artObjectInstance in this.LevelMaterializer.LevelArtObjects) { artObjectInstance.Visible = this.AoVisibility[num++]; if (artObjectInstance.Visible) { artObjectInstance.ArtObject.Group.Enabled = true; } } } if ((double)this.SinceStarted > 36.75) { if (this.Rings != null) { foreach (ArtObjectInstance aoInstance in this.Rings) { this.LevelManager.RemoveArtObject(aoInstance); } this.maskRenderer.Visible = true; this.LevelManager.Scripts[4].Disabled = false; this.LevelManager.Scripts[5].Disabled = false; this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(0); } this.Rings = (ArtObjectInstance[])null; float num = Easing.EaseIn(1.0 - (double)FezMath.Saturate((float)(((double)this.SinceStarted - 36.75) / 6.0)), EasingType.Sine); if (FezMath.AlmostEqual(num, 0.0f)) { return; } this.TargetRenderer.DrawFullscreen(new Color(1f, 1f, 1f, num)); } else { if ((double)this.SinceStarted <= 33.0) { return; } this.TargetRenderer.DrawFullscreen(new Color(1f, 1f, 1f, FezMath.Saturate(Easing.EaseIn(((double)this.TrialTimeAccumulator - 3.0) / 0.75, EasingType.Quintic)))); this.TrialRaysMesh.Draw(); this.TrialFlareMesh.Draw(); } }
private void TryInitialize() { this.warpGateAo = Enumerable.FirstOrDefault <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x => x.ArtObject.ActorType == ActorType.WarpGate)); this.Visible = this.Enabled = this.warpGateAo != null; if (!this.Enabled) { foreach (KeyValuePair <WarpDestinations, WarpPanel> keyValuePair in this.panels) { keyValuePair.Value.PanelMask.Dispose(); keyValuePair.Value.Layers.Dispose(); } this.panels.Clear(); } else { if (this.panels.Count == 0) { Mesh mesh1 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), DepthWrites = false, Texture = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/fullwhite")) }; mesh1.AddFace(new Vector3(3.875f), Vector3.Backward * (25.0 / 16.0), FaceOrientation.Front, true); Mesh mesh2 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), AlwaysOnTop = true, DepthWrites = false, SamplerState = SamplerState.PointClamp }; Texture2D texture2D1 = this.CMProvider.Global.Load <Texture2D>("Other Textures/warp/nature/background"); mesh2.AddFace(new Vector3(10f, 4f, 10f), Vector3.Forward * 5f, FaceOrientation.Front, true).Texture = (Texture)texture2D1; mesh2.AddFace(new Vector3(10f, 4f, 10f), Vector3.Right * 5f, FaceOrientation.Left, true).Texture = (Texture)texture2D1; mesh2.AddFace(new Vector3(10f, 4f, 10f), Vector3.Left * 5f, FaceOrientation.Right, true).Texture = (Texture)texture2D1; Group group1 = mesh2.AddFace(new Vector3(32f, 32f, 1f), new Vector3(0.0f, 2f, -8f), FaceOrientation.Front, true); group1.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Skies/WATERFRONT/WATERFRONT_C"); group1.Material = new Material() { Opacity = 0.3f, Diffuse = Vector3.Lerp(Vector3.One, new Vector3(0.1215686f, 0.96f, 1f), 0.7f) }; Group group2 = mesh2.AddFace(new Vector3(32f, 32f, 1f), new Vector3(0.0f, 2f, -8f), FaceOrientation.Front, true); group2.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Skies/WATERFRONT/WATERFRONT_B"); group2.Material = new Material() { Opacity = 0.5f, Diffuse = Vector3.Lerp(Vector3.One, new Vector3(0.1215686f, 0.96f, 1f), 0.5f) }; Group group3 = mesh2.AddFace(new Vector3(32f, 32f, 1f), new Vector3(0.0f, 2f, -8f), FaceOrientation.Front, true); group3.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Skies/WATERFRONT/WATERFRONT_A"); group3.Material = new Material() { Opacity = 1f, Diffuse = Vector3.Lerp(Vector3.One, new Vector3(0.1215686f, 0.96f, 1f), 0.4f) }; this.panels.Add(WarpDestinations.First, new WarpPanel() { PanelMask = mesh1, Layers = mesh2, Face = FaceOrientation.Front, Destination = "NATURE_HUB" }); Mesh mesh3 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), DepthWrites = false, Texture = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/fullwhite")) }; mesh3.AddFace(new Vector3(3.875f), Vector3.Right * (25.0 / 16.0), FaceOrientation.Right, true); Mesh mesh4 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), AlwaysOnTop = true, DepthWrites = false, SamplerState = SamplerState.PointClamp }; Texture2D texture2D2 = this.CMProvider.Global.Load <Texture2D>("Other Textures/warp/graveyard/back"); Group group4 = mesh4.AddFace(Vector3.One * 16f, Vector3.Zero, FaceOrientation.Right, true); group4.Texture = (Texture)texture2D2; group4.SamplerState = SamplerState.PointWrap; mesh4.AddFace(new Vector3(1f, 16f, 32f), new Vector3(-8f, 4f, 0.0f), FaceOrientation.Right, true).Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Skies/GRAVE/GRAVE_CLOUD_C"); mesh4.AddFace(new Vector3(1f, 16f, 32f), new Vector3(-8f, 4f, 0.0f), FaceOrientation.Right, true).Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Skies/GRAVE/GRAVE_CLOUD_B"); mesh4.AddFace(new Vector3(1f, 16f, 32f), new Vector3(-8f, 4f, 0.0f), FaceOrientation.Right, true).Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Skies/GRAVE/GRAVE_CLOUD_A"); Group group5 = mesh4.AddFace(Vector3.One * 16f, Vector3.Zero, FaceOrientation.Right, true); group5.SamplerState = SamplerState.PointWrap; group5.Blending = new BlendingMode?(BlendingMode.Additive); group5.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/warp/graveyard/rainoverlay"); this.panels.Add(WarpDestinations.Graveyard, new WarpPanel() { PanelMask = mesh3, Layers = mesh4, Face = FaceOrientation.Right, Destination = "GRAVEYARD_GATE" }); Mesh mesh5 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), DepthWrites = false, Texture = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/fullwhite")) }; mesh5.AddFace(new Vector3(3.875f), Vector3.Left * (25.0 / 16.0), FaceOrientation.Left, true); Mesh mesh6 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), AlwaysOnTop = true, DepthWrites = false, SamplerState = SamplerState.PointClamp }; Texture2D texture2D3 = this.CMProvider.Global.Load <Texture2D>("Other Textures/warp/industrial/background"); mesh6.AddFace(new Vector3(10f, 4f, 10f), Vector3.Right * 5f, FaceOrientation.Left, true).Texture = (Texture)texture2D3; mesh6.AddFace(new Vector3(10f, 4f, 10f), Vector3.Backward * 5f, FaceOrientation.Back, true).Texture = (Texture)texture2D3; mesh6.AddFace(new Vector3(10f, 4f, 10f), Vector3.Forward * 5f, FaceOrientation.Front, true).Texture = (Texture)texture2D3; Group group6 = mesh6.AddFace(new Vector3(1f, 8f, 8f), new Vector3(8f, 0.0f, 0.0f), FaceOrientation.Left, true); group6.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/warp/industrial/INDUST_CLOUD_B"); group6.Material = new Material() { Opacity = 0.5f }; Group group7 = mesh6.AddFace(new Vector3(1f, 8f, 8f), new Vector3(8f, 0.0f, 0.0f), FaceOrientation.Left, true); group7.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/warp/industrial/INDUST_CLOUD_F"); group7.Material = new Material() { Opacity = 0.325f }; this.panels.Add(WarpDestinations.Mechanical, new WarpPanel() { PanelMask = mesh5, Layers = mesh6, Face = FaceOrientation.Left, Destination = "INDUSTRIAL_HUB" }); Mesh mesh7 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), DepthWrites = false, Texture = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/fullwhite")) }; mesh7.AddFace(new Vector3(3.875f), Vector3.Forward * (25.0 / 16.0), FaceOrientation.Back, true); Mesh mesh8 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), AlwaysOnTop = true, DepthWrites = false, SamplerState = SamplerState.PointClamp }; Texture2D texture2D4 = this.CMProvider.Global.Load <Texture2D>("Skies/SEWER/BRICK_BACKGROUND"); Group group8 = mesh8.AddFace(Vector3.One * 16f, Vector3.Backward * 8f, FaceOrientation.Back, true); group8.Texture = (Texture)texture2D4; group8.SamplerState = SamplerState.PointWrap; Group group9 = mesh8.AddFace(Vector3.One * 16f, Vector3.Right * 8f, FaceOrientation.Left, true); group9.Texture = (Texture)texture2D4; group9.SamplerState = SamplerState.PointWrap; Group group10 = mesh8.AddFace(Vector3.One * 16f, Vector3.Left * 8f, FaceOrientation.Right, true); group10.Texture = (Texture)texture2D4; group10.SamplerState = SamplerState.PointWrap; Group group11 = mesh8.AddFace(new Vector3(128f, 8f, 1f), new Vector3(0.0f, 4f, -8f), FaceOrientation.Back, true); group11.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/warp/sewer/sewage"); group11.SamplerState = SamplerState.PointWrap; this.panels.Add(WarpDestinations.Sewers, new WarpPanel() { PanelMask = mesh7, Layers = mesh8, Face = FaceOrientation.Back, Destination = "SEWER_HUB" }); Mesh mesh9 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), DepthWrites = false, Texture = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/fullwhite")) }; mesh9.AddFace(new Vector3(3.875f), Vector3.Backward * (25.0 / 16.0), FaceOrientation.Front, true); Mesh mesh10 = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), AlwaysOnTop = true, DepthWrites = false, SamplerState = SamplerState.PointClamp }; Texture2D texture2D5 = this.CMProvider.Global.Load <Texture2D>("Other Textures/warp/zu/back"); Group group12 = mesh10.AddFace(new Vector3(16f, 32f, 16f), Vector3.Zero, FaceOrientation.Front, true); group12.Texture = (Texture)texture2D5; group12.SamplerState = SamplerState.PointWrap; Group group13 = mesh10.AddFace(new Vector3(32f, 32f, 1f), new Vector3(0.0f, 0.0f, -8f), FaceOrientation.Front, true); group13.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Skies/ABOVE/ABOVE_C"); group13.Material = new Material() { Opacity = 0.4f, Diffuse = Vector3.Lerp(new Vector3(0.6862745f, 1f, 0.97647f), new Vector3(0.1294118f, 0.4f, 1f), 0.7f) }; Group group14 = mesh10.AddFace(new Vector3(32f, 32f, 1f), new Vector3(0.0f, 0.0f, -8f), FaceOrientation.Front, true); group14.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Skies/ABOVE/ABOVE_B"); group14.Material = new Material() { Opacity = 0.6f, Diffuse = Vector3.Lerp(new Vector3(0.6862745f, 1f, 0.97647f), new Vector3(0.1294118f, 0.4f, 1f), 0.6f) }; Group group15 = mesh10.AddFace(new Vector3(32f, 32f, 1f), new Vector3(0.0f, 0.0f, -8f), FaceOrientation.Front, true); group15.Texture = (Texture)this.CMProvider.Global.Load <Texture2D>("Skies/ABOVE/ABOVE_A"); group15.Material = new Material() { Opacity = 1f, Diffuse = Vector3.Lerp(new Vector3(0.6862745f, 1f, 0.97647f), new Vector3(0.1294118f, 0.4f, 1f), 0.5f) }; this.panels.Add(WarpDestinations.Zu, new WarpPanel() { PanelMask = mesh9, Layers = mesh10, Face = FaceOrientation.Front, Destination = "ZU_CITY_RUINS" }); } if (Fez.LongScreenshot) { this.GameState.SaveData.UnlockedWarpDestinations.Add("SEWER_HUB"); this.GameState.SaveData.UnlockedWarpDestinations.Add("GRAVEYARD_GATE"); this.GameState.SaveData.UnlockedWarpDestinations.Add("INDUSTRIAL_HUB"); this.GameState.SaveData.UnlockedWarpDestinations.Add("ZU_CITY_RUINS"); } string str = this.LevelManager.Name.Replace('\\', '/'); this.CurrentLevelName = str.Substring(str.LastIndexOf('/') + 1); if (!this.GameState.SaveData.UnlockedWarpDestinations.Contains(this.CurrentLevelName)) { this.GameState.SaveData.UnlockedWarpDestinations.Add(this.CurrentLevelName); } else if (this.GameState.SaveData.UnlockedWarpDestinations.Count > 1) { ICollection <Volume> values = this.LevelManager.Volumes.Values; Func <Volume, bool> predicate = (Func <Volume, bool>)(x => { if (x.ActorSettings != null && x.ActorSettings.IsPointOfInterest) { return((double)Vector3.DistanceSquared(FezMath.GetCenter(x.BoundingBox), this.warpGateAo.Position) < 4.0); } else { return(false); } }); Volume volume; if ((volume = Enumerable.FirstOrDefault <Volume>((IEnumerable <Volume>)values, predicate)) != null) { volume.ActorSettings.DotDialogue.Clear(); volume.ActorSettings.DotDialogue.AddRange((IEnumerable <DotDialogueLine>) new DotDialogueLine[3] { new DotDialogueLine() { ResourceText = "DOT_WARP_A", Grouped = true }, new DotDialogueLine() { ResourceText = "DOT_WARP_B", Grouped = true }, new DotDialogueLine() { ResourceText = "DOT_WARP_UP", Grouped = true } }); bool flag; if (this.GameState.SaveData.OneTimeTutorials.TryGetValue("DOT_WARP_A", out flag) && flag) { volume.ActorSettings.PreventHey = true; } } } Vector3 zero = Vector3.Zero; if (this.warpGateAo.ArtObject.Cubemap.Height == 128) { zero -= Vector3.UnitY; } foreach (WarpPanel warpPanel in this.panels.Values) { warpPanel.PanelMask.Position = this.warpGateAo.Position + zero; warpPanel.Layers.Position = this.warpGateAo.Position + zero; warpPanel.Enabled = warpPanel.Destination != this.CurrentLevelName && this.GameState.SaveData.UnlockedWarpDestinations.Contains(warpPanel.Destination); if (warpPanel.Destination == "ZU_CITY_RUINS") { switch (this.CurrentLevelName) { case "NATURE_HUB": warpPanel.Face = FaceOrientation.Front; warpPanel.PanelMask.Rotation = Quaternion.Identity; warpPanel.Layers.Rotation = Quaternion.Identity; continue; case "GRAVEYARD_GATE": warpPanel.Face = FaceOrientation.Right; warpPanel.PanelMask.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 1.570796f); warpPanel.Layers.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 1.570796f); continue; case "INDUSTRIAL_HUB": warpPanel.Face = FaceOrientation.Left; warpPanel.PanelMask.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 4.712389f); warpPanel.Layers.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 4.712389f); continue; case "SEWER_HUB": warpPanel.Face = FaceOrientation.Back; warpPanel.PanelMask.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 3.141593f); warpPanel.Layers.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 3.141593f); continue; default: continue; } } } } }
public static Mesh GetUnityMesh(this ArtObjectInstance ao) { return(ao.ArtObject.GetUnityMesh()); }
public IEnumerator FillCoroutine(Level level) { Level = level; if (string.IsNullOrEmpty(name)) { name = level.Name; //Offset the triles and everything back transform.position -= FezHelper.TrileOffset; } Triles.Clear(); ArtObjects.Clear(); if (chunksObj != null) { Destroy(chunksObj); } chunksObj = new GameObject("Chunks"); chunksObj.transform.parent = transform; chunksObj.isStatic = true; chunks.Clear(); TrileSet = FezManager.Instance.GetUnityTrileSet(level.TrileSetName); level.TrileSet = TrileSet.TrileSet; yield return(null); if (level.SkyName != null) { GameObject skyObj = new GameObject("Sky (" + level.SkyName + ")"); skyObj.transform.parent = transform; Sky = skyObj.AddComponent <FezUnitySky>(); Sky.Fill(FezManager.Instance.GetUnitySky(level.SkyName)); yield return(null); } if (SetupLightingOnFill) { SetupLighting(); } if (level.WaterType != LiquidType.None) { GameObject waterObj = new GameObject("Water"); waterObj.transform.parent = transform; waterObj.transform.localPosition = new Vector3(level.Size.x / 2f, level.WaterHeight, level.Size.z / -2f); Water = waterObj.AddComponent <FezUnityWater>(); Water.Fill(level.WaterType); } int asset = 0; GameObject trilesObj = new GameObject("Triles"); trilesObj.transform.parent = transform; trilesObj.transform.position += FezHelper.TrileOffset; foreach (KeyValuePair <TrileEmplacement, TrileInstance> pair in level.Triles) { TrileInstance trile = pair.Value; if (trile.TrileId == -1) { continue; } SetTrileInInstance(trile); GameObject trileObj = trile.GenObject(trilesObj); Triles[pair.Key] = trileObj; if (IsHidden(trile.Emplacement)) { trileObj.SetActive(false); } else { AddToChunk(trileObj); asset++; } if (asset >= AssetsPerFrame) { asset = 0; yield return(pair); } else { asset++; } } GameObject aosObj = new GameObject("Art Objects"); aosObj.transform.parent = transform; foreach (KeyValuePair <int, ArtObjectInstance> pair in level.ArtObjects) { ArtObjectInstance ao = pair.Value; ao.ArtObject = FezManager.Instance.GetArtObject(ao.ArtObjectName); ArtObjects[pair.Key] = ao.GenObject(aosObj); if (asset >= AssetsPerFrame) { asset = 0; yield return(pair); } else { asset++; } } GameObject planesObj = new GameObject("Background Planes"); planesObj.transform.parent = transform; foreach (KeyValuePair <int, BackgroundPlane> pair in level.BackgroundPlanes) { BackgroundPlane plane = pair.Value; BackgroundPlanes[pair.Key] = plane.GenObject(planesObj); if (asset >= AssetsPerFrame) { asset = 0; yield return(pair); } else { asset++; } } GameObject npcsObj = new GameObject("NPCs"); npcsObj.transform.parent = transform; foreach (KeyValuePair <int, NpcInstance> pair in level.NonPlayerCharacters) { NpcInstance npc = pair.Value; NPCs[pair.Key] = npc.GenObject(npcsObj); if (asset >= AssetsPerFrame) { asset = 0; yield return(pair); } else { asset++; } } asset = 0; IEnumerator buildc = BuildChunks(); while (buildc.MoveNext()) { if (asset >= ChunksPerFrame) { asset = 0; yield return(buildc.Current); } else { asset++; } } }
public MailboxState(ArtObjectInstance aoInstance) { ServiceHelper.InjectServices((object)this); this.MailboxAo = aoInstance; }
private void TryInitialize() { this.Enabled = false; this.ArtObject = Enumerable.FirstOrDefault <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x => { if (x.ArtObject.ActorType == ActorType.Rumbler) { return(x.ActorSettings.VibrationPattern != null); } else { return(false); } })); if (this.ArtObject != null) { this.Enabled = true; if (this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.ArtObject.Id)) { if (this.ArtObject.ActorSettings.AttachedGroup.HasValue) { int key = this.ArtObject.ActorSettings.AttachedGroup.Value; foreach (TrileInstance instance in this.LevelManager.Groups[this.ArtObject.ActorSettings.AttachedGroup.Value].Triles.ToArray()) { this.LevelManager.ClearTrile(instance); } this.LevelManager.Groups.Remove(key); } this.LevelManager.ArtObjects.Remove(this.ArtObject.Id); this.ArtObject.Dispose(); this.LevelMaterializer.RegisterSatellites(); Vector3 position1 = this.ArtObject.Position; if (!this.GameState.SaveData.ThisLevel.DestroyedTriles.Contains(new TrileEmplacement(position1 - Vector3.One / 2f))) { Trile trile = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube)); if (trile != null) { Vector3 position2 = position1 - Vector3.One / 2f; this.LevelManager.ClearTrile(new TrileEmplacement(position2)); TrileInstance toAdd; this.LevelManager.RestoreTrile(toAdd = new TrileInstance(position2, trile.Id) { OriginalEmplacement = new TrileEmplacement(position2) }); if (toAdd.InstanceId == -1) { this.LevelMaterializer.CullInstanceIn(toAdd); } } } this.Enabled = false; } } if (this.Enabled) { this.eForkRumble = SoundEffectExtensions.Emit(this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/ForkRumble"), true, 0.0f, 0.0f); this.ActivateSound = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/MiscActors/ForkActivate"); this.ArtObject.ActorSettings.VibrationPattern = Util.JoinArrays <VibrationMotor>(this.ArtObject.ActorSettings.VibrationPattern, new VibrationMotor[3]); } else { this.ActivateSound = (SoundEffect)null; this.eForkRumble = (SoundEmitter)null; } }