//Event handler for every time the rain timer ticks private void rain_Tick(object sender, EventArgs e) { for (int i = 0; i < rainAmount; i++) { int nextInt = Rand.Next(0, rainDokiesSelected); int nextSizeInt = Rand.Next(0, rainSizeCount); if (!justMonika) { if (nextInt == 0 && !rainSayori) { nextInt++; } if (nextInt == 1 && !rainNatsuki) { nextInt++; } if (nextInt == 2 && !rainYuri) { nextInt++; } } else { nextInt = (int)Who.wMonika; } if (nextSizeInt == 0 && !rainLarge) { nextSizeInt++; } if (nextSizeInt == 1 && !rainMedium) { nextSizeInt++; } Who next = (Who)nextInt; DokiSize nextSize = (DokiSize)nextSizeInt; Doki doki = null; switch (next) { case Who.wSayori: doki = GetSayori((int)nextSize, true); break; case Who.wNatsuki: doki = GetNatsuki((int)nextSize, true); break; case Who.wYuri: doki = GetYuri((int)nextSize, true); break; case Who.wMonika: doki = GetMonika((int)nextSize, true); break; } doki.Location = new Point(Rand.Next(0, doki.rWall), -doki.Height - 5); doki.Show(); } rain.Interval = Rand.Next(lowerRainInterval, higherRainInterval + 1); }
//Adds a doki based on current radio button settings private void addDoki() { getSize(); Doki doki = GetDoki(); addDokiControlls(doki); }
//Adds the kill button and name to the alive list private void addDokiControlls(Doki doki, string tText = "") { Label t = new Label(); if (string.IsNullOrEmpty(tText)) { t.Text = getText(); } else { t.Text = tText; } doki.Location = new Point(Rand.Next(0, doki.rWall), Rand.Next(0, doki.floor / 2)); Dokies.Add(doki); doki.Show(); FlowLayoutPanel p = new FlowLayoutPanel(); p.Name = "test"; p.FlowDirection = FlowDirection.LeftToRight; p.Size = new Size(this.fpAlive.ClientSize.Width - 25, 25); p.Controls.Add(t); Button b = new Button(); b.Text = "Kill"; if (justMonika) { b.Enabled = false; } p.Controls.Add(b); p.Disposed += (ss, ee) => { this.fpAlive.Controls.Remove(p); t.Dispose(); b.Dispose(); }; b.Click += (ss, ee) => { p.Dispose(); }; b.Click += doki.DokiCloseHandle; this.fpAlive.Controls.Add(p); }
//Adds a doki based on manual settings private void addDoki(Who who, int size, string tText) { Doki doki = null; switch (who) { case Who.wSayori: doki = GetSayori(size); break; case Who.wNatsuki: doki = GetNatsuki(size); break; case Who.wYuri: doki = GetYuri(size); break; case Who.wMonika: doki = GetMonika(size); break; } addDokiControlls(doki, tText); }