Repository navigation
Code & Style Conventions
Last updated: 20th of June 2021
Boy Scout Rule: "Always leave the code you're editing a little better than you found it". Software will never be possible, but if you see the opportunity and it won't take a significant amount of time, improve it. Initiative: Don't wait until someone else does it, take the initiative! AoTTG2 is a large project, so if you see something that can be done better, do it or create an issue for it.
Try to use ScriptableObjects when you are dealing with configuration data. Using ScriptableObjects allows us to easily modify & extend logic that uses these.
When you enter these, you are dealing with logic which has been outdated. When you are working on your issue, and you encounter one of these, see if it is possible to refactor the logic (if related to your issue) within a reasonable time. If it is, do it. If it does take more time, check if there's an issue already for it, if not, create it.
New text that is introduced MUST be localized. For localization we use Unity's Localization Package. To add a new localization key, either extend an existing table within Assets/Localization or create a new category.
For runtime localization you can use the convenient static class named Localization.
Compile time localization can conveniently be done by adding a "Localize String Event" component to the UI.
- Prefer /// summary comments over // comments. These summary comments also get included within our DocFX Documents (https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/summary)
- Decisions (We did this weird logic due to Issue #666, to assure to Isk cannot spawn)
- Complex methods (Generally methods should be simple, but for complicated algorithms or long methods this is fine)
- public/abstract classes (Define the scope & responsibilities of the class)
- public/protected/internal/virtual methods (Describe what the method is supposed to do)
- public/protected/internal properties/fields (Describe the purpose of the property / field)
- interfaces
- events
Do not use a hardcoded string for PhotonView.RPC, instead make use of nameof(methodRpc). Using nameof allows us to easily see which methods are used and makes renaming RPCs easier.
Invalid
photonView.RPC("MethodRpc"
Valid
photonView.RPC(nameof(MethodRpc)
