(CNN) -- A heavily armed man opened fire on a public safety building in McKinney, Texas, on Tuesday and attempted to ignite explosive substances in his truck before he died in an exchange of gunfire with law enforcement, police said.

No one was injured in the attack, which unfolded in fewer than five minutes, according to McKinney Police Chief Doug Kowalski.

Authorities said the incident began about 9 a.m., when 29-year-old Patrick Gray Sharp pulled his truck, which was hauling a trailer, in front of the Department of Public Safety building in McKinney, about 30 miles north of Dallas.

Sharp set the truck on fire, igniting ammunition inside the vehicle in what police believe was a tactic to draw people out of the building, Kowalski said. Sharp also attempted to set fire to the truck's trailer, which was carrying wood chips, road flares, gasoline and ammonium nitrate fertilizer, but it failed to ignite, Kowalski said.

"It looks like it was possibly an improvised explosive device," he said.

Sharp then retreated across the street to a tree line on the campus of Collin College, where he began firing on the public safety building's offices and windows and on employees who were outside, Kowalski said.

Several campus structures were also struck by gunfire.

Sharp was killed after exchanging shots with police. Witnesses told police that it appeared he killed himself. Kowalski said the coroner will make the determination of who delivered the fatal shot.

"I've been a police officer over 33 years now in several major departments. This is a little bit unprecedented," Kowalski said. "He had a plan, he was activating his plan, he was heavily armed, and he looked like he knew what he wanted to do. What we don't know is why he wanted to do it."

Sharp was found carrying an assault rifle, a 12-gauge shotgun and a .45-caliber semiautomatic pistol, Kowalski said, adding that several loaded ammunition magazines were found on his body.

More than 100 shell casings have been recovered from the scene, he said.

Kowalski credited the lack of injuries to police training as well as improvements made to the public safety building in the wake of the September 11 terrorist attacks. Though more than 20 windows were blown out by the gunfire, the building's solid masonry work -- left pockmarked by the shots -- absorbed much of the blow.

"Everyone did an outstanding job of containing the situation to keep it from expanding today," Kowalski said.

In addition to local authorities, the U.S. Bureau of Alcohol, Tobacco, Firearms and Explosives and the FBI are assisting in the investigation.

"At this point, we are really trying to determine why he targeted the McKinney Police Department and also officers of Collin College and their police department," Kowalski said.

Sharp, of Anna, Texas, was a student at Collin College at one point in 2004, though Kowalski said "it doesn't seem like he had any particular beef with the college" or with police.

"This doesn't make any sense to any of us," he said. "The act is completely senseless."