public RainSound(Room room) { owner = room; for (int r = 0; r < owner.TileWidth; r++) { if (owner.Tiles[r, owner.TileHeight - 1].Solid) { ceiling++; } } if (!Downpour.snow) { if (ceiling < (owner.Width * 0.95) && owner.regionGate == null) { normalRainSound = new DisembodiedDynamicSoundLoop(this); normalRainSound.sound = SoundID.Normal_Rain_LOOP; heavyRainSound = new DisembodiedDynamicSoundLoop(this); heavyRainSound.sound = SoundID.Heavy_Rain_LOOP; } else if (!Downpour.interiorRain) { interiorRainSound = new DisembodiedDynamicSoundLoop(this); interiorRainSound.sound = SoundID.Flash_Flood_LOOP; rumbleSound = new DisembodiedDynamicSoundLoop(this); rumbleSound.sound = SoundID.Death_Rain_Heard_From_Underground_LOOP; } } }
// Token: 0x06001D30 RID: 7472 RVA: 0x001998E4 File Offset: 0x00197AE4 public override void Update(bool eu) { base.Update(eu); if (Intensity == 0f) { return; } if (soundLoop == null) { soundLoop = new DisembodiedDynamicSoundLoop(this); soundLoop.sound = SoundID.Death_Lightning_Heavy_Lightning_LOOP; } else { soundLoop.Update(); soundLoop.Volume = Intensity; } if (soundLoop2 == null) { soundLoop2 = new DisembodiedDynamicSoundLoop(this); soundLoop2.sound = SoundID.Death_Lightning_Early_Sizzle_LOOP; } else { soundLoop2.Update(); soundLoop2.Volume = Mathf.Pow(Intensity, 0.1f) * Mathf.Lerp(0.5f + 0.5f * Mathf.Sin(sin * 3.14159274f * 2f), 0f, Mathf.Pow(Intensity, 8f)); } lastSin = sin; sin += Intensity * 0.1f; if (closeToWallTiles != null && room.BeingViewed && UnityEngine.Random.value < Mathf.InverseLerp(1000f, 9120f, (float)(room.TileWidth * room.TileHeight)) * Intensity) { IntVector2 pos = closeToWallTiles[UnityEngine.Random.Range(0, closeToWallTiles.Count)]; Vector2 pos2 = room.MiddleOfTile(pos) + new Vector2(Mathf.Lerp(-10f, 10f, UnityEngine.Random.value), Mathf.Lerp(-10f, 10f, UnityEngine.Random.value)); float num = UnityEngine.Random.value * Intensity; if (room.ViewedByAnyCamera(pos2, 50f)) { room.AddObject(new ElectricStorm.SparkFlash(pos2, num)); } room.PlaySound(SoundID.Death_Lightning_Spark_Spontaneous, pos2, num, 1f); } for (int i = 1; i < flashes.Length; i++) { flashes[i].Update(); } lastColor = color; color = Vector3.Lerp(color, getToColor, UnityEngine.Random.value * 0.3f); if (UnityEngine.Random.value < 0.333333343f) { getToColor.x = UnityEngine.Random.value; } else if (UnityEngine.Random.value < 0.333333343f) { getToColor.y = UnityEngine.Random.value; } else if (UnityEngine.Random.value < 0.333333343f) { getToColor.z = UnityEngine.Random.value; } if (Intensity > 0.5f && UnityEngine.Random.value < Custom.LerpMap(Intensity, 0.5f, 1f, 0f, 0.5f)) { for (int j = 0; j < room.physicalObjects.Length; j++) { for (int k = 0; k < room.physicalObjects[j].Count; k++) { for (int l = 0; l < room.physicalObjects[j][k].bodyChunks.Length; l++) { if (UnityEngine.Random.value < Custom.LerpMap(Intensity, 0.5f, 1f, 0f, 0.5f) && (room.physicalObjects[j][k].bodyChunks[l].ContactPoint.x != 0 || room.physicalObjects[j][k].bodyChunks[l].ContactPoint.y != 0 || room.GetTile(room.physicalObjects[j][k].bodyChunks[l].pos).AnyBeam)) { float num2 = Mathf.Pow(UnityEngine.Random.value, 0.9f) * Mathf.InverseLerp(0.5f, 1f, Intensity); room.AddObject(new ElectricStorm.SparkFlash(room.physicalObjects[j][k].bodyChunks[l].pos + room.physicalObjects[j][k].bodyChunks[l].rad * room.physicalObjects[j][k].bodyChunks[l].ContactPoint.ToVector2(), Mathf.Pow(num2, 0.5f))); Vector2 vector = -(room.physicalObjects[j][k].bodyChunks[l].ContactPoint.ToVector2() + Custom.RNV()).normalized; vector *= 22f * num2 / room.physicalObjects[j][k].bodyChunks[l].mass; room.physicalObjects[j][k].bodyChunks[l].vel += vector; room.physicalObjects[j][k].bodyChunks[l].pos += vector; room.PlaySound(SoundID.Death_Lightning_Spark_Object, room.physicalObjects[j][k].bodyChunks[l].pos, num2, 1f); if (room.physicalObjects[j][k] is Creature) { (room.physicalObjects[j][k] as Creature).Violence(null, null, room.physicalObjects[j][k].bodyChunks[l], null, Creature.DamageType.Electric, num2 * 1.8f, num2 * 40f); } } } } } } }