public void OnDeserialization() { foreach (TrileEmplacement index in this.Triles.Keys) { TrileInstance trileInstance1 = this.Triles[index]; if (this.Triles[index].Emplacement != index) { this.Triles[index].Emplacement = index; } trileInstance1.Update(); trileInstance1.OriginalEmplacement = index; if (trileInstance1.Overlaps) { foreach (TrileInstance trileInstance2 in trileInstance1.OverlappedTriles) { trileInstance2.OriginalEmplacement = index; } } } foreach (int index in this.Scripts.Keys) { this.Scripts[index].Id = index; } foreach (int index in this.Volumes.Keys) { this.Volumes[index].Id = index; } foreach (int index in this.NonPlayerCharacters.Keys) { this.NonPlayerCharacters[index].Id = index; } foreach (int index in this.ArtObjects.Keys) { this.ArtObjects[index].Id = index; } foreach (int index in this.BackgroundPlanes.Keys) { this.BackgroundPlanes[index].Id = index; } foreach (int index in this.Paths.Keys) { this.Paths[index].Id = index; } foreach (int index1 in this.Groups.Keys) { TrileGroup trileGroup = this.Groups[index1]; trileGroup.Id = index1; TrileEmplacement[] trileEmplacementArray = new TrileEmplacement[trileGroup.Triles.Count]; for (int index2 = 0; index2 < trileEmplacementArray.Length; ++index2) { trileEmplacementArray[index2] = trileGroup.Triles[index2].Emplacement; } trileGroup.Triles.Clear(); foreach (TrileEmplacement index2 in trileEmplacementArray) { trileGroup.Triles.Add(this.Triles[index2]); } } }
public HeavyGroupState(TrileGroup group) { ServiceHelper.InjectServices((object) this); this.group = group; int minY = Enumerable.Min<TrileInstance>((IEnumerable<TrileInstance>) group.Triles, (Func<TrileInstance, int>) (x => x.Emplacement.Y)); group.Triles.Sort((Comparison<TrileInstance>) ((a, b) => a.Emplacement.Y - b.Emplacement.Y)); this.bottomTriles = Enumerable.ToArray<TrileInstance>(Enumerable.Where<TrileInstance>((IEnumerable<TrileInstance>) group.Triles, (Func<TrileInstance, bool>) (x => x.Emplacement.Y == minY))); foreach (TrileInstance instance in group.Triles) instance.PhysicsState = new InstancePhysicsState(instance); this.MarkGrounds(); }
protected override void Begin() { base.Begin(); if (this.eCratePush == null || this.eCratePush.Dead) this.eCratePush = SoundEffectExtensions.EmitAt(this.sCratePush, this.PlayerManager.PushedInstance.Center, true); else this.eCratePush.Cue.Resume(); if (this.eGomezPush == null || this.eGomezPush.Dead) this.eGomezPush = SoundEffectExtensions.EmitAt(this.sGomezPush, this.PlayerManager.Position, true); else this.eGomezPush.Cue.Resume(); if (this.LevelManager.PickupGroups.TryGetValue(this.PlayerManager.PushedInstance, out this.pickupGroup)) return; this.pickupGroup = (TrileGroup) null; }
public TrileGroup(TrileGroup group) : this() { this.Name = group.Name; this.Triles = new List <TrileInstance>(Enumerable.Select <TrileInstance, TrileInstance>((IEnumerable <TrileInstance>)group.Triles, (Func <TrileInstance, TrileInstance>)(x => x.Clone()))); this.Heavy = group.Heavy; this.ActorType = group.ActorType; this.Path = group.Path == null ? (MovementPath)null : group.Path.Clone(); this.GeyserPauseFor = group.GeyserPauseFor; this.GeyserLiftFor = group.GeyserLiftFor; this.GeyserApexHeight = group.GeyserApexHeight; this.GeyserOffset = group.GeyserOffset; this.SpinClockwise = group.SpinClockwise; this.SpinFrequency = group.SpinFrequency; this.SpinNeedsTriggering = group.SpinNeedsTriggering; this.SpinCenter = group.SpinCenter; this.Spin180Degrees = group.Spin180Degrees; this.FallOnRotate = group.FallOnRotate; this.SpinOffset = group.SpinOffset; this.AssociatedSound = group.AssociatedSound; }
public TrileGroup(TrileGroup group) : this() { this.Name = group.Name; this.Triles = new List<TrileInstance>(Enumerable.Select<TrileInstance, TrileInstance>((IEnumerable<TrileInstance>) group.Triles, (Func<TrileInstance, TrileInstance>) (x => x.Clone()))); this.Heavy = group.Heavy; this.ActorType = group.ActorType; this.Path = group.Path == null ? (MovementPath) null : group.Path.Clone(); this.GeyserPauseFor = group.GeyserPauseFor; this.GeyserLiftFor = group.GeyserLiftFor; this.GeyserApexHeight = group.GeyserApexHeight; this.GeyserOffset = group.GeyserOffset; this.SpinClockwise = group.SpinClockwise; this.SpinFrequency = group.SpinFrequency; this.SpinNeedsTriggering = group.SpinNeedsTriggering; this.SpinCenter = group.SpinCenter; this.Spin180Degrees = group.Spin180Degrees; this.FallOnRotate = group.FallOnRotate; this.SpinOffset = group.SpinOffset; this.AssociatedSound = group.AssociatedSound; }
public void OnDeserialization() { _init(); foreach (TrileEmplacement key in Triles.Keys) { TrileInstance trile = Triles[key]; /*if (Triles[key].Emplacement != key) { * Triles[key].Emplacement = key; * }*/ //trile.Update(); trile.OriginalEmplacement = key; //FIXME remove trile.OverlappedTriles != null if (trile.OverlappedTriles != null && trile.OverlappedTriles.Count > 0) { foreach (TrileInstance trileOverlapping in trile.OverlappedTriles) { trileOverlapping.OriginalEmplacement = key; } } } foreach (int id in Scripts.Keys) { Scripts[id].Id = id; } foreach (int id in Volumes.Keys) { Volumes[id].Id = id; } foreach (int id in NonPlayerCharacters.Keys) { NonPlayerCharacters[id].Id = id; } foreach (int id in ArtObjects.Keys) { ArtObjects[id].Id = id; } foreach (int id in BackgroundPlanes.Keys) { BackgroundPlanes[id].Id = id; } foreach (int id in Paths.Keys) { Paths[id].Id = id; } foreach (int id in Groups.Keys) { TrileGroup trileGroup = Groups[id]; trileGroup.Id = id; /*TrileEmplacement[] trileEmplacementArray = new TrileEmplacement[trileGroup.Triles.Count]; * for (int i = 0; i < trileEmplacementArray.Length; i++) { * trileEmplacementArray[i] = trileGroup.Triles[i].Emplacement; * } * trileGroup.Triles.Clear(); * //FIXME crashes here as key cannot be found in Triles * foreach (TrileEmplacement key in trileEmplacementArray) { * trileGroup.Triles.Add(Triles[key]); * }*/ } }
public MovingGroupState(TrileGroup group, bool connective) { this.LevelManager = ServiceHelper.Get<ILevelManager>(); this.CMProvider = ServiceHelper.Get<IContentManagerProvider>(); this.Group = group; this.IsConnective = connective; this.neededTrigger = this.Path.NeedsTrigger; this.paused = this.neededTrigger; this.referenceOrigins = new Vector3[group.Triles.Count]; this.MarkedPosition = Vector3.Zero; int num = 0; foreach (TrileInstance trileInstance in group.Triles) { this.MarkedPosition += trileInstance.Center; this.referenceOrigins[num++] = trileInstance.Position; } this.MarkedPosition /= (float) group.Triles.Count; if (!group.PhysicsInitialized) { foreach (TrileInstance instance in group.Triles) instance.PhysicsState = new InstancePhysicsState(instance); group.PhysicsInitialized = true; } this.Segments = new List<PathSegment>((IEnumerable<PathSegment>) this.Path.Segments); foreach (TrileInstance trileInstance in group.Triles) trileInstance.ForceSeeThrough = true; if (this.Path.EndBehavior == PathEndBehavior.Bounce) { for (int index = this.Segments.Count - 1; index >= 0; --index) { PathSegment pathSegment = this.Segments[index]; Vector3 vector3 = index == 0 ? Vector3.Zero : this.Segments[index - 1].Destination; this.Segments.Add(new PathSegment() { Acceleration = pathSegment.Deceleration, Deceleration = pathSegment.Acceleration, Destination = vector3, Duration = pathSegment.Duration, JitterFactor = pathSegment.JitterFactor, WaitTimeOnFinish = pathSegment.WaitTimeOnStart, WaitTimeOnStart = pathSegment.WaitTimeOnFinish, Bounced = true }); } } if (this.Path.SoundName != null) { try { this.eAssociatedSound = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/" + this.Path.SoundName), Vector3.Zero, true, true); } catch (Exception ex) { Logger.Log("Moving groups", LogSeverity.Warning, "Could not find sound " + this.Path.SoundName); this.Path.SoundName = (string) null; } } if (this.IsConnective) { this.eConnectiveIdle = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Industrial/ConnectiveIdle"), Vector3.Zero, true, true); this.sConnectiveKlonk = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Industrial/ConnectiveKlonk"); this.sConnectiveStartUp = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Industrial/ConnectiveStartUp"); } if (!this.IsConnective) { this.attachedAOs = Enumerable.ToArray<ArtObjectInstance>(Enumerable.Where<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => { int? local_0 = x.ActorSettings.AttachedGroup; int local_1 = group.Id; if (local_0.GetValueOrDefault() == local_1) return local_0.HasValue; else return false; }))); if (this.attachedAOs.Length > 0) this.aoOrigins = Enumerable.ToArray<Vector3>(Enumerable.Select<ArtObjectInstance, Vector3>((IEnumerable<ArtObjectInstance>) this.attachedAOs, (Func<ArtObjectInstance, Vector3>) (x => x.Position))); this.attachedPlanes = Enumerable.ToArray<BackgroundPlane>(Enumerable.Where<BackgroundPlane>((IEnumerable<BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values, (Func<BackgroundPlane, bool>) (x => { int? local_0 = x.AttachedGroup; int local_1 = group.Id; if (local_0.GetValueOrDefault() == local_1) return local_0.HasValue; else return false; }))); if (this.attachedPlanes.Length > 0) this.planeOrigins = Enumerable.ToArray<Vector3>(Enumerable.Select<BackgroundPlane, Vector3>((IEnumerable<BackgroundPlane>) this.attachedPlanes, (Func<BackgroundPlane, Vector3>) (x => x.Position))); } else { foreach (TrileInstance trileInstance in this.Group.Triles) trileInstance.ForceClampToGround = true; } this.Enabled = true; this.Silent = true; this.Reset(); this.StartNewSegment(); this.Silent = false; this.sinceSegmentStarted -= TimeSpan.FromSeconds((double) this.Path.OffsetSeconds); }
public PickupState(TrileInstance ti, TrileGroup group) { this.Instance = ti; this.OriginalCenter = ti.Center; this.Group = group; }
public ValveState(ValvesBoltsTimeswitchesHost host, ArtObjectInstance ao) { ServiceHelper.InjectServices((object) this); this.Host = host; this.ArtObject = ao; this.IsBolt = this.ArtObject.ArtObject.ActorType == ActorType.BoltHandle; this.IsTimeswitch = this.ArtObject.ArtObject.ActorType == ActorType.Timeswitch; BoundingBox boundingBox = new BoundingBox(this.ArtObject.Position - this.ArtObject.ArtObject.Size / 2f, this.ArtObject.Position + this.ArtObject.ArtObject.Size / 2f); if (this.ArtObject.ActorSettings.AttachedGroup.HasValue) this.AttachedGroup = this.LevelManager.Groups[this.ArtObject.ActorSettings.AttachedGroup.Value]; if (this.IsTimeswitch) { this.eTimeswitchWindBack = SoundEffectExtensions.EmitAt(this.Host.TimeswitchWindBackSound, ao.Position, true, true); foreach (ArtObjectInstance artObjectInstance in (IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values) { if (artObjectInstance != ao && artObjectInstance.ArtObject.ActorType == ActorType.TimeswitchMovingPart) { BoundingBox box = new BoundingBox(artObjectInstance.Position - artObjectInstance.ArtObject.Size / 2f, artObjectInstance.Position + artObjectInstance.ArtObject.Size / 2f); if (boundingBox.Intersects(box)) { this.TimeswitchScrewAo = artObjectInstance; break; } } } } int num1; if (!this.IsBolt && !this.IsTimeswitch && (this.GameState.SaveData.ThisLevel.PivotRotations.TryGetValue(this.ArtObject.Id, out num1) && num1 != 0)) { int num2 = Math.Abs(num1); int num3 = Math.Sign(num1); for (int index = 0; index < num2; ++index) this.ArtObject.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.UnitY, 1.570796f * (float) num3); } if (this.IsBolt) { foreach (TrileInstance instance in this.AttachedGroup.Triles) instance.PhysicsState = new InstancePhysicsState(instance); } foreach (Volume volume in (IEnumerable<Volume>) this.LevelManager.Volumes.Values) { Vector3 vector3 = FezMath.Abs(volume.To - volume.From); if ((double) vector3.X == 3.0 && (double) vector3.Z == 3.0 && ((double) vector3.Y == 1.0 && boundingBox.Contains(volume.BoundingBox) == ContainmentType.Contains)) { this.CenterOffset = (volume.From + volume.To) / 2f - this.ArtObject.Position; break; } } }
public RotatingGroupState(TrileGroup group) { ServiceHelper.InjectServices((object) this); this.Group = group; this.AttachedArtObjects = Enumerable.ToArray<ArtObjectInstance>(Enumerable.Where<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => { int? local_0 = x.ActorSettings.AttachedGroup; int local_1 = this.Group.Id; if (local_0.GetValueOrDefault() == local_1) return local_0.HasValue; else return false; }))); this.AttachedAoOrigins = Enumerable.ToArray<Vector3>(Enumerable.Select<ArtObjectInstance, Vector3>((IEnumerable<ArtObjectInstance>) this.AttachedArtObjects, (Func<ArtObjectInstance, Vector3>) (x => x.Position))); this.AttachedAoRotations = Enumerable.ToArray<Quaternion>(Enumerable.Select<ArtObjectInstance, Quaternion>((IEnumerable<ArtObjectInstance>) this.AttachedArtObjects, (Func<ArtObjectInstance, Quaternion>) (x => x.Rotation))); this.CachedMaterializers = Enumerable.ToArray<TrileMaterializer>(Enumerable.Select<TrileInstance, TrileMaterializer>((IEnumerable<TrileInstance>) group.Triles, (Func<TrileInstance, TrileMaterializer>) (x => this.LevelMaterializer.GetTrileMaterializer(x.Trile)))); foreach (TrileInstance trileInstance in this.Group.Triles) { trileInstance.ForceSeeThrough = true; trileInstance.Unsafe = true; } float num = Enumerable.Max<TrileInstance>(Enumerable.Where<TrileInstance>((IEnumerable<TrileInstance>) this.Group.Triles, (Func<TrileInstance, bool>) (x => !x.Trile.Immaterial)), (Func<TrileInstance, float>) (x => x.Position.Y)); foreach (TrileInstance trileInstance in this.Group.Triles) { if ((double) trileInstance.Position.Y == (double) num) this.TopLayer.Add(trileInstance); } if (this.Group.SpinCenter != Vector3.Zero) { this.Center = this.Group.SpinCenter; } else { foreach (TrileInstance trileInstance in this.Group.Triles) this.Center += trileInstance.Position + FezMath.HalfVector; this.Center /= (float) this.Group.Triles.Count; } this.Enabled = !this.Group.SpinNeedsTriggering; this.SinceChanged = -this.Group.SpinOffset; if ((double) this.SinceChanged != 0.0) this.SinceChanged -= 0.375f; if (string.IsNullOrEmpty(group.AssociatedSound)) return; try { this.sSpin = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/MiscActors/" + group.AssociatedSound); } catch (Exception ex) { Logger.Log("RotatingGroups", LogSeverity.Warning, "Could not find associated sound '" + group.AssociatedSound + "'"); } }
public SuckBlockState(TrileInstance instance, TrileGroup group) { this.Instance = instance; this.Group = group; }
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))); }
public SwitchState(TrileGroup group, SoundEffect clickSound, SoundEffect thudSound, SoundEffect releaseSound) { foreach (TrileInstance instance in Enumerable.Where<TrileInstance>((IEnumerable<TrileInstance>) group.Triles, (Func<TrileInstance, bool>) (x => x.PhysicsState == null))) instance.PhysicsState = new InstancePhysicsState(instance) { Sticky = true }; this.ClickSound = clickSound; this.ThudSound = thudSound; this.ReleaseSound = releaseSound; this.Permanence = group.ActorType == ActorType.PushSwitchPermanent ? PushSwitchesHost.SwitchState.SwitchPermanence.Permanent : (group.ActorType == ActorType.PushSwitchSticky ? PushSwitchesHost.SwitchState.SwitchPermanence.Sticky : PushSwitchesHost.SwitchState.SwitchPermanence.Volatile); this.Group = group; this.OriginalHeight = group.Triles[0].Position.Y; ServiceHelper.InjectServices((object) this); if (this.Permanence != PushSwitchesHost.SwitchState.SwitchPermanence.Permanent || !this.GameState.SaveData.ThisLevel.InactiveGroups.Contains(this.Group.Id)) return; this.action = PushSwitchesHost.SwitchState.SwitchAction.HeldDown; }
public PivotState(PivotsHost host, ArtObjectInstance handleAo) { ServiceHelper.InjectServices((object) this); this.Host = host; this.HandleAo = handleAo; this.Group = this.LevelManager.Groups[handleAo.ActorSettings.AttachedGroup.Value]; this.AttachedArtObjects = Enumerable.ToArray<ArtObjectInstance>(Enumerable.Where<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => { int? local_0 = x.ActorSettings.AttachedGroup; int local_1 = this.Group.Id; if ((local_0.GetValueOrDefault() != local_1 ? 0 : (local_0.HasValue ? 1 : 0)) != 0) return x != this.HandleAo; else return false; }))); this.AttachedAoOrigins = Enumerable.ToArray<Vector3>(Enumerable.Select<ArtObjectInstance, Vector3>((IEnumerable<ArtObjectInstance>) this.AttachedArtObjects, (Func<ArtObjectInstance, Vector3>) (x => x.Position))); this.AttachedAoRotations = Enumerable.ToArray<Quaternion>(Enumerable.Select<ArtObjectInstance, Quaternion>((IEnumerable<ArtObjectInstance>) this.AttachedArtObjects, (Func<ArtObjectInstance, Quaternion>) (x => x.Rotation))); foreach (TrileInstance trileInstance in this.Group.Triles) trileInstance.ForceSeeThrough = true; float num = Enumerable.Max<TrileInstance>(Enumerable.Where<TrileInstance>((IEnumerable<TrileInstance>) this.Group.Triles, (Func<TrileInstance, bool>) (x => !x.Trile.Immaterial)), (Func<TrileInstance, float>) (x => x.Position.Y)); foreach (TrileInstance trileInstance in this.Group.Triles) { if ((double) trileInstance.Position.Y == (double) num) this.TopLayer.Add(trileInstance); } if (this.LevelManager.Name == "WATER_TOWER" && this.LevelManager.LastLevelName == "LIGHTHOUSE") { if (this.GameState.SaveData.ThisLevel.PivotRotations.ContainsKey(handleAo.Id)) this.GameState.SaveData.ThisLevel.PivotRotations[handleAo.Id] = 0; } else { int initialSpins; if (this.GameState.SaveData.ThisLevel.PivotRotations.TryGetValue(handleAo.Id, out initialSpins) && initialSpins != 0) this.ForceSpinTo(initialSpins); } if (!this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.HandleAo.Id)) return; this.HandleAo.Enabled = false; }
public GeyserState(TrileGroup group, GeysersHost host) { ServiceHelper.InjectServices((object) this); this.Host = host; this.Group = group; this.SinceStateChange = TimeSpan.FromSeconds(-(double) group.GeyserOffset); Vector3 position = Enumerable.Aggregate<TrileInstance, Vector3>((IEnumerable<TrileInstance>) this.Group.Triles, Vector3.Zero, (Func<Vector3, TrileInstance, Vector3>) ((a, b) => a + b.Center)) / (float) group.Triles.Count; int key1 = IdentifierPool.FirstAvailable<BackgroundPlane>(this.LevelManager.BackgroundPlanes); this.TopPlane = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, "sewer/sewer_geyser_top", true) { Id = key1, Position = position, YTextureRepeat = true, Crosshatch = true, Doublesided = true }; this.LevelManager.BackgroundPlanes.Add(key1, this.TopPlane); int key2 = IdentifierPool.FirstAvailable<BackgroundPlane>(this.LevelManager.BackgroundPlanes); this.TilePlane = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, "sewer/sewer_geyser_tile", true) { Id = key2, Position = position, YTextureRepeat = true, Billboard = true }; this.LevelManager.BackgroundPlanes.Add(key2, this.TilePlane); this.TopPlane.Timing.Step = this.TilePlane.Timing.Step; this.loopEmitter = SoundEffectExtensions.EmitAt(this.Host.LoopSound, position, true, 0.0f, 0.0f); foreach (TrileInstance trileInstance in group.Triles) { trileInstance.PhysicsState.IgnoreCollision = true; trileInstance.PhysicsState.IgnoreClampToWater = true; } }
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; } }