public Animal(int weight, int range, animalType type, int weightGain) { this.weight = weight; this.range = range; this.weightGain = weightGain; this.type = type; alive = true; locationX = random.Next(0, Settings.Instance().NumbersOfAreas); locationY = random.Next(0, Settings.Instance().NumbersOfAreas); if (random.Next(1, 3) == 1) { this.gender = gender.male; } else { gender = gender.female; } }
public void Move() { while (true) { int temp = random.Next(locationX - range, locationX + range + 1); if (temp >= 0 && temp < Settings.Instance().NumbersOfAreas) { locationX = temp; break; } } while (true) { int temp = random.Next(locationY - range, locationY + range + 1); if (temp >= 0 && temp < Settings.Instance().NumbersOfAreas) { locationY = temp; break; } } }