private void Awake() { if (null != _instance) { throw new Exception("LifeBarContainer instance already exists."); } _instance = this; rectTransform = GetComponent <RectTransform>(); }
private readonly Dictionary <MobStatus, LifeGauge> _statusLifeBarMap = new Dictionary <MobStatus, LifeGauge>(); // アクティブなライフゲージを保持するコンテナ private void Awake() { // シーン上に1つしか存在させないスクリプトのため、このような疑似シングルトンが成り立つ if (null != _instance) { throw new Exception("LifeBarContainer instance already exists."); } _instance = this; rectTransform = GetComponent <RectTransform>(); }