Frank is right...take cover when available
Running away would be best if that is an option
But it really does depend.......
For instance....bad guy 10 feet in front of you....cover is 20 feet behind you...
Turning your back on the bad guy and running to cover would probably be a bad idea
Moving laterally on the draw and then backing towards cover while firing might be a good idea
Advancing on him while emptying your weapon might be better
Once again...it depends