// Token: 0x06000E4B RID: 3659 RVA: 0x000976D0 File Offset: 0x000958D0 public void DrawSprites(RoomCamera.SpriteLeaser sLeaser, RoomCamera rCam, float timeStacker, Vector2 camPos) { Shader.SetGlobalFloat("_rainDirection", 1f); Shader.SetGlobalVector("_RainSpriteRect", new Vector4(camPos.x / (20f * (float)this.room.TileWidth), camPos.y / (20f * (float)this.room.TileHeight), 1366f / (20f * (float)this.room.TileWidth), 768f / (20f * (float)this.room.TileHeight))); Shader.SetGlobalFloat("_rainIntensity", Mathf.InverseLerp(0f, 0.5f, this.intensity)); if (this.dangerType == BattleRoomRain.DangerType.Rain) { Shader.SetGlobalFloat("_rainEverywhere", Mathf.Max(0.1f, this.RainUnderCeilings)); } for (int i = 0; i < sLeaser.sprites.Length; i++) { sLeaser.sprites[i].isVisible = (this.intensity > 0f); } sLeaser.sprites[0].shader = ((this.intensity <= 0f) ? this.room.game.rainWorld.Shaders["Basic"] : this.room.game.rainWorld.Shaders["DeathRain"]); if (this.intensity == 0f) { return; } for (int j = 1; j < this.splashes; j++) { sLeaser.sprites[j].isVisible = false; for (int k = 0; k < 5; k++) { Vector2 testPos = this.room.MiddleOfTile(this.splashTiles[Random.Range(0, this.splashTiles.Count)]); if (testPos.y > this.room.FloatWaterLevel(testPos.x) && rCam.IsViewedByCameraPosition(rCam.currentCameraPosition, testPos)) { sLeaser.sprites[j].y = testPos.y + 10f - camPos.y; sLeaser.sprites[j].x = testPos.x + Mathf.Lerp(-10f, 10f, Random.value) - camPos.x; sLeaser.sprites[j].isVisible = true; break; } } sLeaser.sprites[j].scaleY = this.SplashSize; if (j < this.splashes / 2) { sLeaser.sprites[j].rotation = Mathf.Lerp(-45f, 45f, Random.value); sLeaser.sprites[j].scaleX = ((Random.value >= 0.5f) ? 1f : -1f) * this.SplashSize; } else { sLeaser.sprites[j].rotation = Mathf.Lerp(-25f, 25f, Random.value); sLeaser.sprites[j].scaleX = Mathf.Lerp(-1f, 1f, Random.value) * this.SplashSize; } sLeaser.sprites[j].color = Color.Lerp(this.pal.fogColor, new Color(1f, 1f, 1f), Random.value * this.intensity); } if (base.slatedForDeletetion || this.room != rCam.room) { sLeaser.CleanSpritesAndRemove(); } }
public override void DrawSprites(RoomCamera.SpriteLeaser sLeaser, RoomCamera rCam, float timeStacker, Vector2 camPos) { Vector2 vector = Vector2.Lerp(this.lastPos, this.pos, timeStacker); Vector2 vector2 = Vector2.Lerp(this.lastLastLastPos, this.lastLastPos, timeStacker); if (Custom.DistLess(vector, vector2, 9f)) { vector2 = vector + Custom.DirVec(vector, vector2) * 12f; } vector2 = Vector2.Lerp(vector, vector2, Mathf.InverseLerp(0f, 0.1f, 1f)); Vector2 a = Custom.PerpendicularVector((vector - vector2).normalized); (sLeaser.sprites[0] as TriangleMesh).MoveVertice(0, vector + a * (this.depth + (this.depth * 0.1f)) - camPos); (sLeaser.sprites[0] as TriangleMesh).MoveVertice(1, vector - a * (this.depth + (this.depth * 0.1f)) - camPos); (sLeaser.sprites[0] as TriangleMesh).MoveVertice(2, vector2 - camPos); sLeaser.sprites[1].x = vector.x - camPos.x; sLeaser.sprites[1].y = vector.y - camPos.y; sLeaser.sprites[1].rotation = UnityEngine.Random.value * 360f; if (Downpour.rainbow) { sLeaser.sprites[0].color = Color.Lerp(color, Color.Lerp(rCam.PixelColorAtCoordinate(this.pos), rCam.PixelColorAtCoordinate(this.lastLastLastPos), 0.5f), 0.36f); } else { sLeaser.sprites[0].color = Color.Lerp(new Color(1f, 1f, 1f), Color.Lerp(rCam.currentPalette.fogColor, Color.Lerp(rCam.PixelColorAtCoordinate(this.pos), rCam.PixelColorAtCoordinate(this.lastLastLastPos), 0.5f), 0.83f), 0.95f); } //If background drops encounter a depth in the room texture lower than their own depth value, treat it as a collision. if (backgroundDrop && !reset && !this.collision && rCam.IsViewedByCameraPosition(rCam.cameraNumber, this.pos) && rCam.DepthAtCoordinate(this.pos) < this.depth) { splashCounter = 1f; timeToDie = true; sLeaser.sprites[1].color = Color.Lerp(color, rCam.PixelColorAtCoordinate(this.pos), 0.7f); this.collision = true; } if (splashCounter > 0f && !backgroundDrop) { sLeaser.sprites[1].color = Color.Lerp(color, rCam.PixelColorAtCoordinate(this.pos), 0.2f); } if (splashCounter > 0f) { //If splash counter is greater than 0 adjust the scale of the splash sprite based on whether its a background drop or not. if (backgroundDrop) { sLeaser.sprites[1].scale = Mathf.Lerp(0f, this.depth * 0.4f, splashCounter); this.vel.y = 0f; this.vel.x = 0f; } else { sLeaser.sprites[1].scale = Mathf.Lerp(0f, UnityEngine.Random.Range(0.25f, 0.42f), splashCounter); } sLeaser.sprites[0].alpha = 0f; } else { sLeaser.sprites[1].scale = 0f; sLeaser.sprites[0].alpha = this.alpha; } //Delete raindrop if it falls a certain distance below the currently viewed room camera if (this.pos.y < (rCam.pos.y - 100f) || (splashCounter <= 0f && timeToDie)) { this.reset = true; } base.DrawSprites(sLeaser, rCam, timeStacker, camPos); }