A new simulational approach to electron-photon showers in heterogeneous media