It means "similarly to" or "in the fashion that would have been chosen had (something) been the case". Using your examples:
1) We should act the way that we would be acting if he had been watching us.
2) It seemed that the sky had blown the heaven into stars.
3) (This last sentence doesn't make sense.)