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 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; }