Between the life of Adam and the life of Noach there was a span of ten generations. Unfortunately each generation's behavior showed a moral decline from that of the previous generation. Although mankind's behavior continued to get worse and worse, however, Hashem was not so fast to punish them. He waited, hoping that people would eventually use good sense and good will, and repent from their sinful ways. In this hope that the wicked people would repent, Hashem sent righteous people to set an example for the rest. However, the few righteous people proved to be unable to spread their good and fix the ways of the bad people. In fact, there was one particular Tzaddik recorded in the Torah by the name of Chanoch,
concerning whom it says "And Chanoch walked in the ways of Hashem" (בראשית ה':כ"ד). Yet, as explained by Rashi (שם), we find that Hashem ended his life prematurely because Hashem was afraid that Chanoch would somehow fall under the evil influences that he was surrounded by during his generation. In this way, Chanoch died as an unblemished Tzaddik and was thus able to be rewarded in Olam HaBo. He was, however, unable to influence any wicked people.
The evil of the era of Noach surpassed that of all previous generations and Hashem knew that the world as it was needed to undergo great change. Hashem decided to destroy all sinful beings by means of a מבול, a flood, and only Noach and his immediate family would be spared to rebuild humanity. Hashem commanded Noach to build an ark; this process took Noach 120 years, as indicated by Rashi (לבראשית ו':י"ד בד"ה עשה). One obvious question is why it took Noach such a long time to build the ark. Why all the unnecessary labor? Hashem could have saved Noach in other ways, and in a shorter amount of time! The answer, as Rashi (שם) says, is that this was all part of Hashem's plan. Hashem hoped that the people would see Noach working on the ark and ask what it was for. Noach would reply that if people won't repent, Hashem will bring a flood upon the earth, and that's why this ark is needed. He could thus urge the people to go repent before it gets too late. By waiting 120 years, Hashem gave humanity plenty of time to annul the decree they deserved.
Noach's message was not heard and the world was destroyed. Hashem, however, always continued to send people to inspire others to do Teshuvah. Eventually, people did realize that they must listen to the messages of those who encourage them to repent. Chazal tell us that Hashem is patient in accepting repentance; He will go to almost any means to encourage it. He thus always sent נביאים, prophets, for this purpose, to warn the people to repent or be destroyed. As seen from Sefer Yonah, Hashem warned even non-Jews in this fashion. Even in our times, although there are no prophets of Hashem, there are people who teach by example how to behave properly and follow the path of Hashem. We should all take their example and not repeat the mistake of the people who did not listen to Noach.