{"id":20924335,"url":"https://github.com/insthync/naming-conventions","last_synced_at":"2026-03-15T16:55:56.820Z","repository":{"id":235934933,"uuid":"791571447","full_name":"insthync/naming-conventions","owner":"insthync","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-15T07:28:06.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T17:53:33.654Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/insthync.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-25T00:44:40.000Z","updated_at":"2024-07-15T07:28:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a828700-648f-492b-8aea-bd6fdd12544e","html_url":"https://github.com/insthync/naming-conventions","commit_stats":null,"previous_names":["insthync/naming-conventions"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insthync%2Fnaming-conventions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insthync%2Fnaming-conventions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insthync%2Fnaming-conventions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insthync%2Fnaming-conventions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insthync","download_url":"https://codeload.github.com/insthync/naming-conventions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243318745,"owners_count":20272139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T20:21:12.464Z","updated_at":"2025-12-27T21:06:51.255Z","avatar_url":"https://github.com/insthync.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unity Project\n\n### Coding\n[ตามนี้เลย](https://unity.com/how-to/naming-and-code-style-tips-c-scripting-unity)\n\n- พวกชื่อ Namespace, Class, Struct, Property, Function, Enum เป็นแบบ `PascalCase` หมด\n- Serialzable Field เป็นแบบ `camelCase` เพราะใน Unity เวลาเราจะทำให้ตัวแปรมัน Serialize ได้ ต้องทำเป็น public field (ไม่ก็ใช้ [SerializeField] attribute) ทำแบบนี้เพื่อให้ชื่อตัวแปรมันไม่ซ้ำกับพวก Property\n- พวก Local Variable/Parameter เป็นแบบ `camelCase` หมด\n- พวก Private/Protected Field ให้มี Prefix เป็น `_` ตามด้วยชื่อเป็นแบบ `camelCase` เช่น `_currentHp` \n- พวกชื่อตัวแปร Boolean ทำให้มันสื่อความหมายโดยใส่คำนำหน้าว่า Is, Has, Can อะไรงี้ เช่น `IsAlive`, `_hasArmor`, `CanUseSkill()`\n- พวกชื่อ `delegate` ให้ใส่ Suffix ว่า `EventHandler` เช่น `public delegate void HpChangedEventHandler(int currentHp);`\n\nตัวอย่าง\n\n```\nnamespace Company.GameName.Gameplay\n{\n    public delegate void HpChangedEventHandler(int currentHp);\n    public class Character\n    {\n        private static int _allCharacterDeadCount = 0;\n        public static int AllCharacterDeadCount =\u003e _allCharacterDeadCount;\n\n        public float damageAbsorbing = 0.5f;\n        public int maxHp = 100;\n        // พวก Delegate มันไม่ถูก Serialize อยู่แล้วใช้แบบ `PascalCase`\n        public HpChangedEventHandler OnHpChanged;\n        \n        private int _currentHp;\n        public string CurrentHp\n        {\n            get =\u003e _currentHp;\n            set {\n                if (_currentHp == value)\n                    return;\n                _currentHp = value;\n                NotifyHpChanged(value);\n                if (IsDead)\n                    _allCharacterDeadCount++;\n            }\n        }\n\n        public bool IsDead =\u003e _currentHp \u003c= 0;\n\n        private void NotifyHpChanged(int changedHp)\n        {\n            OnHpChanged?.Invoke(changedHp);\n        }\n\n        public void Revive()\n        {\n            if (IsDead)\n                return;\n            currentHp = MaxHp;\n        }\n\n        public void ApplyDamage(float damage)\n        {\n            int calculatedDamage = (int)(damage - (damage * damageAbsorbing));\n            currentHp -= calculatedDamage;\n        }\n    }\n}\n```\n\n### Asset\n[ตามนี้ไปก่อน](https://github.com/justinwasilenko/Unity-Style-Guide)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsthync%2Fnaming-conventions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsthync%2Fnaming-conventions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsthync%2Fnaming-conventions/lists"}