Conventions¶
We follow the coding guidelines:
Language | Guideline | Tools |
---|---|---|
Python | https://www.python.org/dev/peps/pep-0008/ | |
C++ | http://wiki.ros.org/CppStyleGuide | clang-format: https://github.com/davetcoleman/roscpp_code_format |
The project follows custom guidelines:
- All scripts are structured like this:
- The script is ordered in regions:
- PUBLIC_MEMBER_VARIABLES
- PRIVATE_MEMBER_VARIABLES
- UNTIY_MONOBEHAVIOUR_METHODS
- PUBLIC_METHODS
- PRIVATE_METHODS
- In PUBLIC_MEMBER_VARIABLES you have define at first your properties and then public variables.
- In PRIVATE_MEMBER_VARIABLES you have define at first your serialized private variables and then the normal ones.
- In UNTIY_MONOBEHAVIOUR_METHODS the order is as follows: Awake, Start, OnEnable, OnDisable, Update
- All variables and functions where it is not instantly clear what it does, have to be commented with a summary.
- Make variables only public if they need to be. Mark variables as Serializable when you need to edit them in the editor.
- The capitalization follows a specific set of rules:
- public variables and properties start with an uppercase
- private variables and properties start with a lowercase
- public functions start with an uppercase
- private functions start with an lowercase
- Coroutines which are accessed in other classes must have a public interface.
- When you store components in a variable, which are directly on the object itself, put a [RequireComponent(typeof(ComponentType))] on top of the class.
We include a template class with all rules implemented.
-
class
TemplateClass
¶ Describe your class shortly here.
Inherits from Monobehaviour
Public Functions
-
void TemplateClass.SomePublicMethod()
Describe the function shortly here.
-
void TemplateClass.ActivateBear()
Describe the function shortly here.
Public Members
-
string TemplateClass.SomePublicVariable
Describe your public variable shortly here.
Property
-
property
TemplateClass::SomeProperty
Describe your property shortly here.
Private Functions
-
void TemplateClass.Awake()
Describe the function shortly here.
-
void TemplateClass.Start()
Describe the function shortly here.
-
void TemplateClass.OnEnable()
Describe the function shortly here.
-
void TemplateClass.OnDisable()
Describe the function shortly here.
-
void TemplateClass.Update()
Describe the function shortly here.
-
void TemplateClass.somePrivateMethod()
Describe the function shortly here.
-
IEnumerator TemplateClass.someBearCoroutine()
Describe the coroutine shortly here.
Private Members
-
float TemplateClass.m_SomeSerializedVariable
Describe your serialized variable shortly here.
-
Rigidbody TemplateClass.m_Rigidbody
Rigidbody component on the object
-
int TemplateClass.m_SomePrivateVariable
Describe your private variable shortly here.
-