I'm not clear on the question.
If you're asking if announcing gives you the right to shoot indiscriminately, then no that would not be legal.
If you're asking if announcing gives the right to shoot to prevent robbery, then it can vary by state. As I said about Duty-To-Retreat, in some cases (maybe all), you have to be unable to retreat. So, shooting someone who is leaving is a big nono.
If you're asking if announcing a threat to scare off an intruder is legal on its own, well duh.
The point of Stand-Your-Ground laws is that it is believed a person who is under threat of potential harm should not have to worry about getting arrested should they decide to defend themselves. They may not be in the right state to validly judge whether retreat is an option. At least that's how it is in Texas, as stated by the man who proposed the change in law.