Sorry…You cannot copy any of the Unreal code. You can learn from it but you should not copy it.
Here is what the FAQ from Unreal Engine site says:
Can I copy and paste the Unreal Engine code into my own project or engine?
If you use any Unreal Engine code in your product (even just a little), then your entire product is governed by the EULA, and royalties are due.
Can I study and learn from the Unreal Engine code, and then utilize that knowledge in writing my own game or competing engine?
Yes, as long as you don’t copy any of the code. Code is copyrighted, but knowledge is free!