How can I detect the amount of light from a specific source being cast onto my character?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Quadrazard

I am making a game based on SCP-001 S. D. Locke’s proposal, and in the game I need the character to take damage when they are exposed to sunlight or moonlight depending on: level of exposure, time of day, etc. I also can’t just raycast because it needs to work from windows at an angle too. Is there any way I can check for these specific lighting conditions?