Its straight forward ... but not easy. Your life or someone else's has to be in imminent danger. If you shoot someone trying to protect your property, you'll run in to trouble with the law. If you are not sure if he is armed then you are not in imminent danger and so cannot shoot. So in the above example you just mentioned you'll be charged with culpable homicide or maybe even murder if he is not armed and about to attack you.

In real life though, there is quite a grey area. You will have to convince a court that you thought your life was in imminent danger (that means you were about to be hurt or killed).