This old example project of mine may help you, it doesn’t solve everything, but it’s made using ray casting.
2D Stealth