The gunman who killed four people and critically wounded a fifth at a Southern California office building knew all the victims and apparently, before opening fire, chained shut the gates to two entrances, delaying police from getting inside, authorities said Thursday.