Is it legal to use UT4's code as reference?

I’m planning on making an FPS game, and I want to reference the code from a successful product to see how the pros do it. I know that UT’s code can’t be copied and used for commercial purposes, but what about reference for your own code? Is that okay?

Note: Product version is not selected because I’m using a slightly modified version of UE4 that allows for Toon shading.

Basically how to set up particular bits of code. Particularly, Weapons and how Switching is handled.

okay, good.

What does reference mean here?

You can be influenced by UT code, but you can’t copy it