Last active
November 7, 2015 20:48
-
-
Save brunomikoski/29308ab12338cdac00f0 to your computer and use it in GitHub Desktop.
CodeGuidelines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using UnityEngine; | |
| // Add one empty line at the end of your file | |
| //Use interfaces | |
| //Max 4 words for per variable | |
| //One method should be do only one thing (Save some exceptions) | |
| //Maximum line width is 100 characters. | |
| //Namespace following the folder order after _ProjectName/Scripts/... | |
| namespace BrunoMikoski.Exemplo | |
| { | |
| /// <summary> | |
| /// Summary for classes with example if is needed is always good | |
| /// </summary> | |
| public class CodeGuidelines : MonoBehaviour | |
| { | |
| //Delegate should have Delegate on nome | |
| public delegate VoidDelegate(); | |
| //Event should use the On prefix | |
| public event VoidDelegate OnEnterEvent; | |
| //SCREAM_CASE for const variables | |
| private const string EXAMPLE_MESSAGE = "simple :)"; | |
| //Variables that need to be exposed on inspector | |
| [SerializeField] | |
| private int maximumPoints; | |
| //camelCase for privated / protected variables | |
| private int pointsGathered; | |
| //public variables with PascalCase | |
| public int PointsGathered | |
| { | |
| get { return pointsGathered; } | |
| } | |
| /// <summary> | |
| /// Simple public method example | |
| /// </summary> | |
| public void IdentationBracketsSpacingExempleMethod() | |
| { | |
| //brackets only if is more than one line of the code | |
| for (int i = 0; i < 5; i++) | |
| Debug.Log(string.Format("This is the index: {0}", i)); | |
| GameObject target; | |
| if (target == null) | |
| Debug.Log("Target is null"); | |
| bool myBool; | |
| //This is good | |
| if (!myBool) | |
| Debug.Log("Is false :)"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment