public void viewWater() { pos1 = rand1.Next(10, 14); pos2 = rand2.Next(-5, -1); Turtles_1 = new WaterObjects(direction.LEFT, 5, pos1, 0, 0.02, true); Logs_1 = new WaterObjects(direction.RIGHT, 4, 0, pos2, 0.04, false); pos1 = rand1.Next(10, 14); Turtles_2 = new WaterObjects(direction.LEFT, 3, pos1, 0, 0.03, true); pos2 = rand2.Next(-5, -1); Logs_2 = new WaterObjects(direction.RIGHT, 2, 0, pos2, 0.05, false); }
public void Update(WaterObjects wo) { if (TravellingLeftward) { WaterColumn -= Speed; } if (!TravellingLeftward) { WaterColumn += Speed; } if ((wo.WaterRow == 4) && !TravellingLeftward && (wo.WaterColumn > 10)) { Random rand = new Random(); int pos = rand.Next(-5, -1); wo.WaterColumn = pos; wo.Speed = (rand.Next(2, 5)) / 100.0; ; } if ((wo.WaterRow == 2) && !TravellingLeftward && (wo.WaterColumn > 10)) { Random rand = new Random(); int pos = rand.Next(-5, -1); wo.WaterColumn = pos; wo.Speed = (rand.Next(2, 5)) / 100.0; ; } if ((wo.WaterRow == 5) && TravellingLeftward && (wo.WaterColumn <= 0)) { Random rand = new Random(); int pos = rand.Next(10, 14); wo.WaterColumn = pos; wo.Speed = (rand.Next(2, 5)) / 100.0; ; } if ((wo.WaterRow == 3) && TravellingLeftward && (wo.WaterColumn <= 0)) { Random rand = new Random(); int pos = rand.Next(10, 14); wo.WaterColumn = pos; wo.Speed = (rand.Next(2, 5)) / 100.0; ; } }