Changing material with sun rotation

I’ve found something that could be solution but atm I have no idea how to connect it.
From rotator extract Y angle and somehow connect it with curve where I will determine value from 0-1, and from rotator math that if its less or equal 180 degree turn 0, from 180-270 and 270-360 turn out curve value that is from 0 to 1 and again to 0