// Token: 0x06000051 RID: 81 RVA: 0x00004498 File Offset: 0x00002698 internal void JPHitRoof(bool up) { if (!this.def.skyfaller.hitRoof) { return; } CellRect cr; if (up) { IntVec3 hrpcell = IntVec3Utility.ToIntVec3(base.DrawPos); IntVec2 punchsize = new IntVec2(3, 3); cr = GenAdj.OccupiedRect(hrpcell, base.Rotation, punchsize); } else { cr = GenAdj.OccupiedRect(this); } if (cr.Cells.Any((IntVec3 x) => GridsUtility.Roofed(x, this.Map))) { RoofDef roof = GridsUtility.GetRoof(cr.Cells.First((IntVec3 x) => GridsUtility.Roofed(x, this.Map)), base.Map); if (!SoundDefHelper.NullOrUndefined(roof.soundPunchThrough)) { SoundStarter.PlayOneShot(roof.soundPunchThrough, new TargetInfo(base.Position, base.Map, false)); } RoofCollapserImmediate.DropRoofInCells(cr.ExpandedBy(1).ClipInsideMap(base.Map).Cells.Where(delegate(IntVec3 c) { if (!GenGrid.InBounds(c, this.Map)) { return(false); } if (cr.Contains(c)) { return(true); } if (GridsUtility.GetFirstPawn(c, this.Map) != null) { return(false); } Building edifice = GridsUtility.GetEdifice(c, this.Map); return(edifice == null || !edifice.def.holdsRoof); }), base.Map, null); if (up) { this.PilotRoofPunchUp = true; return; } this.PilotRoofPunchDown = true; } }
public bool CanAddPlayingOneShot(SoundDef def, SoundInfo info) { if (!SoundDefHelper.CorrectContextNow(def, info.Maker.Map)) { return(false); } if ((from s in this.samples where s.subDef.parentDef == def && s.AgeRealTime < 0.05f select s).Count <SampleOneShot>() >= def.MaxSimultaneousSamples) { return(false); } SampleOneShot sampleOneShot = this.LeastImportantOf(def); return(sampleOneShot == null || this.ImportanceOf(def, info, 0f) >= this.ImportanceOf(sampleOneShot)); }
public bool CanAddPlayingOneShot(SoundDef def, SoundInfo info) { if (!SoundDefHelper.CorrectContextNow(def, info.Maker.Map)) { return(false); } if (samples.Where((SampleOneShot s) => s.subDef.parentDef == def && s.AgeRealTime < 0.05f).Count() >= def.MaxSimultaneousSamples) { return(false); } SampleOneShot sampleOneShot = LeastImportantOf(def); if (sampleOneShot != null && ImportanceOf(def, info, 0f) < ImportanceOf(sampleOneShot)) { return(false); } return(true); }
private void PlayExplosionSound(SoundDef explosionSound) { bool devMode = Prefs.DevMode; bool flag; if (devMode) { flag = (explosionSound != null); } else { flag = !SoundDefHelper.NullOrUndefined(explosionSound); } bool flag2 = flag; if (flag2) { SoundStarter.PlayOneShot(explosionSound, new TargetInfo(base.Position, base.Map, false)); } else { SoundStarter.PlayOneShot(this.damType.soundExplosion, new TargetInfo(base.Position, base.Map, false)); } }
public void SampleOneShotManagerUpdate() { for (int i = 0; i < this.samples.Count; i++) { this.samples[i].Update(); } this.cleanupList.Clear(); for (int j = 0; j < this.samples.Count; j++) { SampleOneShot sampleOneShot = this.samples[j]; if (sampleOneShot.source == null || !sampleOneShot.source.isPlaying || !SoundDefHelper.CorrectContextNow(sampleOneShot.subDef.parentDef, sampleOneShot.Map)) { if (sampleOneShot.source != null && sampleOneShot.source.isPlaying) { sampleOneShot.source.Stop(); } sampleOneShot.SampleCleanup(); this.cleanupList.Add(sampleOneShot); } } if (this.cleanupList.Count > 0) { this.samples.RemoveAll((SampleOneShot s) => this.cleanupList.Contains(s)); } }
public void SampleOneShotManagerUpdate() { for (int i = 0; i < samples.Count; i++) { samples[i].Update(); } cleanupList.Clear(); for (int j = 0; j < samples.Count; j++) { SampleOneShot sampleOneShot = samples[j]; if (sampleOneShot.source == null || (!sampleOneShot.source.isPlaying && (!sampleOneShot.subDef.tempoAffectedByGameSpeed || !Find.TickManager.Paused)) || !SoundDefHelper.CorrectContextNow(sampleOneShot.subDef.parentDef, sampleOneShot.Map)) { if (sampleOneShot.source != null && sampleOneShot.source.isPlaying) { sampleOneShot.source.Stop(); } sampleOneShot.SampleCleanup(); cleanupList.Add(sampleOneShot); } } if (cleanupList.Count > 0) { samples.RemoveAll((SampleOneShot s) => cleanupList.Contains(s)); } }
protected override IEnumerable <Toil> MakeNewToils() { var followAndAttack = new Toil(); followAndAttack.initAction = delegate() { var actor = followAndAttack.actor; var curJob = actor.jobs.curJob; var thing = curJob.GetTarget(this.a).Thing; var pawn1 = thing as Pawn; if (thing != actor.pather.Destination.Thing || (!this.pawn.pather.Moving && !this.pawn.Position.AdjacentTo8WayOrInside(thing))) { RoofDef roofDef = actor.Map.roofGrid.RoofAt(actor.Position); if (roofDef != null) { if (roofDef != RoofDefOf.RoofConstructed) { return; } if (!SoundDefHelper.NullOrUndefined(roofDef.soundPunchThrough)) { SoundStarter.PlayOneShot(roofDef.soundPunchThrough, new TargetInfo(actor.Position, actor.Map, false)); CellRect.CellRectIterator iterator = CellRect.CenteredOn(actor.Position, 1).GetIterator(); while (!iterator.Done()) { Find.CurrentMap.roofGrid.SetRoof(iterator.Current, null); iterator.MoveNext(); } } } RoofDef roofDef2 = actor.Map.roofGrid.RoofAt(thing.Position); if (roofDef2 != null) { if (roofDef2 != RoofDefOf.RoofConstructed) { return; } if (!SoundDefHelper.NullOrUndefined(roofDef2.soundPunchThrough)) { SoundStarter.PlayOneShot(roofDef2.soundPunchThrough, new TargetInfo(actor.Position, actor.Map, false)); CellRect.CellRectIterator iterator2 = CellRect.CenteredOn(thing.Position, 1).GetIterator(); while (!iterator2.Done()) { Find.CurrentMap.roofGrid.SetRoof(iterator2.Current, null); iterator2.MoveNext(); } } } } actor.pather.StartPath(thing, PathEndMode.OnCell); actor.Position = thing.Position; actor.pather.StopDead(); pawn1.pather.StopDead(); pawn1.TakeDamage(new DamageInfo(PurpleIvyDefOf.AlienToxicSting, 3, 0f, -1f, actor, null, null)); if (actor.jobs.curJob != null) { actor.jobs.curDriver.Notify_PatherArrived(); } actor.jobs.TryTakeOrderedJob(PurpleIvyUtils.MeleeAttackJob(actor, pawn1)); }; followAndAttack.defaultCompleteMode = ToilCompleteMode.Never; followAndAttack.EndOnDespawnedOrNull <Toil>(this.a, JobCondition.Succeeded); followAndAttack.FailOn <Toil>(new Func <bool>(this.hunterIsKilled)); yield return(followAndAttack); yield break; }