private int AttemptMove(int xMove, int yMove) { int Fx = x, Fy = y; for (int i = 0; i < (int)speed; i++) { Fx += xMove; Fy += yMove; Toroidal(ref Fx, ref Fy); if (!world.IsOpen(Fx, Fy)) { return(0); } } x = Fx; y = Fy; if (infected) { world.InfectedMark(x, y); } else if (sick) { world.SickMark(x, y); } else { world.HumanMark(x, y); } return(1); }
private void Display() { graphic.Clear(Color.Black); for (int r = 0; r < WIDTH - 1; r++) { for (int c = 0; c < HEIGHT - 1; c++) { if (!zombieLand.IsOpen(r, c)) { bitMap.SetPixel(r, c, Color.Yellow); } } } int aliveCount = 0, sickCount = 0, infectedCount = 0, panicingCount = 0; foreach (Human human in zombieLand.Humans) { //debugBox.Text += "Human#" + human.Index + " see's " + human.HumansInSight() + "\r\n"; //debugBox.Text += "Human#" + human.Index + " see's " + human.InfectedInSight() + "\r\n"; Color humanColor; if (!human.Alive) { humanColor = Color.Gray; } else if (human.Infected) { humanColor = Color.LimeGreen; } else if (human.Sick) { humanColor = Color.Purple; } else if (human.Panic) { humanColor = Color.Red; } else { humanColor = Color.LightSalmon; } bitMap.SetPixel(human.PosX, human.PosY, humanColor); if (human.Alive) { if (human.Infected) { infectedCount++; } else if (human.Sick) { sickCount++; } else { aliveCount++; if (human.Panic) { panicingCount++; } } } } debugBox.Text += "Survivors:" + aliveCount + "\r\n"; debugBox.Text += "Panicing:" + panicingCount + "\r\n"; debugBox.Text += "Sick:" + sickCount + "\r\n"; debugBox.Text += "Infected:" + infectedCount + "\r\n"; debugBox.Text += "Dead:" + (HUMANS - (aliveCount + sickCount + infectedCount)) + "\r\n"; this.Refresh(); }