"Smile, my boy. It's sunrise." are Robin Williams last words on screen and you can tell he knew they would be

I just decided to watch the Night at the Museum movies on a whim the other night (they're fun for what they are) and caught Robin acting rather strange in the 3rd one. And I mean strange in a good way. Like really good for these movies. Spoilers for the movie ahead It's all centered on how the tablet which brings the museum pieces to life is dying and with it, all of the exhibits are dying too. So everyone is facing their mortality and Robin is over there acting his bum off with nothing but facial expressions and "We're ready" and "Let us go"s. It was strange to see Then the movie comes to the end and Robin drops the "sunrise" line and it hits me why he had been acting so well. He knew he was dying, maybe had made concepts of a plan for his end and wanted this to be the final thing he was ever remembered for. Which, sadly knowing what we know now, is an incredibly noble thing for him to have done. Even in death, he gave us one last hope. That magnificent mountain of a man.

Are there any other examples of being able to tell someone is acting in a real life way because there real life is mirroring their acting assignments? Or just actors going all in when they know the end is near (not acting but Bowie with Blackstar is a killer demonstration of this). It was really quite beautiful seeing Robin in his last moments like this. We could all only wish to go out in such style.