public LightningStrike(Preciptator pre) { //Assign the starting position of the lightning strike if (pre.room != null && pre.ceilingTiles != null) { this.room = pre.room; try { this.origin = this.room.MiddleOfTile(pre.ceilingTiles[UnityEngine.Random.Range(0, pre.ceilingTiles.Count - 1)]) + new Vector2(0f, 100f); } catch { Debug.Log("ERROR ASSIGNING ORIGIN"); } this.room.AddObject(new LightningPath(this.origin, this, new Color(1f, 1f, 1f))); } }
public Blizzard(Preciptator preciptator) { if (Downpour.debug) { Debug.Log("DOWNPOUR: Blizzard Created"); } this.preciptator = preciptator; this.room = this.preciptator.room; this.particleLimit = 70; if (this.room.roomSettings.RainIntensity > 0f) { this.room.AddObject(new Blizzard.ScrollingTexture(this.room, this, "overlay1", 4.5f, 0.3f)); this.room.AddObject(new Blizzard.ScrollingTexture(this.room, this, "overlay1", 8.5f, 0.31f)); this.room.AddObject(new Blizzard.ScrollingTexture(this.room, this, "overlay2", 5f, 1f)); this.room.AddObject(new Blizzard.ScrollingTexture(this.room, this, "overlay2", 6.3f, 1f)); } }
public SnowFlake(Vector2 pos, Color color, float rainIntensity, Preciptator spawner) { this.screenReset = false; this.foreground = false; this.splashCounter = 0; this.collision = false; this.spawner = spawner; if (Downpour.rainbow) { this.color = Custom.HSL2RGB(UnityEngine.Random.Range(0f, 1f), 0.5f, 0.5f); } else { this.color = Color.Lerp(color, new Color(1f, 1f, 1f), 0.7f); } this.defaultPos = pos; this.resetPos = new Vector2(pos.x, spawner.room.RoomRect.top + UnityEngine.Random.Range(130f, 1700f)); this.pos = pos; this.lastPos = this.pos; this.lastLastPos = this.pos; this.lastLastLastPos = this.pos; this.dir = (new Vector2(UnityEngine.Random.Range(-2f, 0.1f), -5f) * rainIntensity); this.gravity = Mathf.Lerp(0.4f, 0.9f, UnityEngine.Random.value); this.pos += vel * (40f * rainIntensity); this.dir = new Vector2(-this.dir.x + (directionAdjust * RainFall.rainIntensity), this.dir.y); this.vel = this.dir; this.pos += vel * (4f * rainIntensity); dirCounter = UnityEngine.Random.Range(2f, 10f); switch (spawner.direction) { case 1: directionAdjust = -1.2f; break; case 2: directionAdjust = 0f; break; case 3: directionAdjust = 1.2f; break; } //Depth this.depth = UnityEngine.Random.Range(0f, 0.9f); }
public RainDrop(Vector2 pos, Color color, float rainIntensity, Preciptator spawner) { this.alpha = UnityEngine.Random.Range(0.9f, 1f); this.spawner = spawner; this.timeToDie = false; this.splashCounter = 0; this.collision = false; //Small chance for any raindrop to be a background drop, assign it a random depth value if (Downpour.bg && UnityEngine.Random.value > 0.85f) { backgroundDrop = true; this.depth = UnityEngine.Random.value; } else { backgroundDrop = false; this.depth = UnityEngine.Random.Range(0.7f, 1f); } if (Downpour.rainbow) { this.color = Custom.HSL2RGB(UnityEngine.Random.value, 0.5f, 0.5f); } else { this.color = color; } this.resetPos = new Vector2(pos.x, spawner.room.RoomRect.top + 150f); this.pos = new Vector2(pos.x, UnityEngine.Random.Range(pos.y, spawner.room.RoomRect.top + 150f)); this.lastPos = this.pos; this.lastLastPos = this.pos; this.lastLastLastPos = this.pos; //Vary starting velocity this.vel.y = UnityEngine.Random.Range(-10f * rainIntensity, -20f * rainIntensity); //Increase spread of raindrops as rain intensity increases this.vel.x = Mathf.Lerp(UnityEngine.Random.Range(-4, 3f), UnityEngine.Random.Range(-12f, 3f), RainFall.rainIntensity); this.gravity = Mathf.Lerp(0.8f, 1f, UnityEngine.Random.value); }