Since this is a total AND sudden electrical failure it could be due to battery being dead and/or regulator/rectifier failing to charge the battery correctly and/or generator failure.
Get a good multimeter and let's start. (Keep in mind these concern my bike)
To start with you will need to verify your battery state. You can start by simply measuring the battery voltage which in healthy fully charged state should be ~12.5V or more. You can also visit a battery dealer who would have better tools to check if your battery holds charge etc.
To check whether your regulator provides enough charging current to your battery you will need to start your motorcycle and measure your battery terminals once again. While your vehicle is idling (~1000RPM) you should see ~12-13V (but not less than 12V) and while revving up (~5000RPM) you should see that increase up to ~14.5V (but not more than 15V). These values might differ based on lights on/off and other electrical devices running on your motorcycle. Specific values could be found on your motorcycle's service manual or over forums.
To quickly check your generator for mechanical damage without removing any covers, you could try removing your spark plug, and rotate your engine by engaging a 5th gear and rotating the rear wheel. If the engine movement is not smooth or hear any weird clicks and clacks behind the generator cover, it could be an indication of a fractured generator rotor-coils. Additionally you can remove your generator cover and inspect it's state.
To check your generator for electrical issues, you will need to locate it's connector to the rectifier/regulator. Usually 3 (or 2 in some cases) yellow cables end up there). Inspect the connector as it is a common failure point in the charging system. Unplug this and measure resistance between all pairs (1-2, 2-3, 3-1) of yellow cables these, should all be short-circuited or very low (to the magnitude of <1Ωhm).
Now start your engine with the connector unplugged and measure the ~AC between each pair. While idling (~1000RPM) you should see ~25+/-10V and while revving up (~5000RPM) you should see that increase up to ~75+/-10V. Specific values could be found on your motorcycle's service manual or over forums.
Useful links on testing your regulator for failure: