Type definitions — blueprints for objects and value types
PascalCase
PlayerController
Interface
Contract that a class promises to implement
I + PascalCase
IStateMachine
Public / Protected Method
Callable behavior exposed to other code
PascalCase
Execute()
Public / Protected Property
Controlled access to internal state
PascalCase
IsOpen
Local Function
Helper method scoped inside another method
PascalCase
HexToInt()
Constant (const)
Compile-time immutable value, never changes
UPPER_SNAKE
MAX_HEALTH
Non-private Static Field
Shared state across all instances of a class
PascalCase
PhaseNames
Non-private Readonly Field
Set once (ctor or inline), then immutable
PascalCase
DefaultValue
Private Static Field
Class-level shared state, hidden from outside
s_ + camelCase
s_instance
Private Instance Field
Per-object internal state, hidden from outside
_ + camelCase
_health
Local Variable
Temporary value scoped to a method or block
camelCase
currentState
Parameter
Value passed into a method by the caller
camelCase
buildContext
Enum Member
One named option within an enum type
PascalCase
MovingForward
Type Parameter
Generic placeholder resolved at compile time
T + PascalCase
TValue
Namespace
Logical grouping that prevents name collisions
PascalCase, dot-separated
PixelEngine.Core.FSM
Rules
Rule
Enforced
Private fields use _ prefix, not m_
Yes
No Hungarian notation (strName, iCount)
Yes
Acronyms > 2 chars use PascalCase (Http, not HTTP)
Yes
Bool fields/properties start with Is, Has, Can, Should
Suggested
Event fields use past tense (Died, Spawned)
Suggested
Event handler methods use On prefix (OnDied)
Suggested
One type per file, filename matches type name
Yes
Examples
public class WeaponSystem : IDisposable
{
public const int MAX_AMMO = 30;
private static int s_instanceCount;
[Serializable]
public readonly struct Configuration : IConfiguration
{
public readonly float reloadTime;
public static readonly Configuration Default = new Configuration(1.5f);
public Configuration(float reloadTime)
{
this.reloadTime = reloadTime;
}
}
[Serializable]
public readonly struct Reference : IReference
{
public static readonly Reference Default = new Reference();
}
public struct State : IState
{
public int currentAmmo;
public bool isReloading;
}
public class Components : IComponents { }
private Configuration _configuration;
private Reference _reference;
private State _state;
public Configuration configuration => _configuration;
public Reference reference => _reference;
public State state => _state;
public Components components { get; private set; }
public event Action<int> AmmoChanged;
// ... constructors, Init, Dispose ...
}