1. 데이터와 로직, 뷰의 분리

"MonoBehaviour에 모든 걸 때려박지 마라."

public class Player : MonoBehaviour
{
    public PlayerStats stats;
    private PlayerController controller;

    void Awake()
    {
        controller = new PlayerController(stats);
    }

    void Update()
    {
        controller.HandleInput();
    }
}

2. 명확한 책임 분리 (SRP 원칙)

하나의 클래스가 하나의 역할만 하도록 설계하기.

3. 이벤트 기반 구조 연습

느슨한 연결(Loosely Coupled)은 유지보수의 핵심.

public class PlayerStats : MonoBehaviour
{
    public event Action OnHealthChanged;
    public void TakeDamage(int amount)
    {
        health -= amount;
        OnHealthChanged?.Invoke();
    }
}

4. 컴포넌트 기반 설계 사고 유지