public EventDispatcher() { if (eventDataPool == null) { eventDataPool = new ItemObjectPool <EventData>(); } }
// Start is called before the first frame update void Start() { rotateStage = StageManager.Instance.transform; gemObjectPool = new ItemObjectPool <Gem>(gemPrefab, "Gems"); bombObjectPool = new ItemObjectPool <Bomb>(bombPrefab, "Bombs"); clockObjectPool = new ItemObjectPool <SpeedClock>(clockPrefab, "SpeedClocks"); gemObjectPool.PreloadAsync(preloadCount: 15, threshold: 2).Subscribe(); bombObjectPool.PreloadAsync(preloadCount: 10, threshold: 2).Subscribe(); clockObjectPool.PreloadAsync(preloadCount: 3, threshold: 2).Subscribe(); Observable.Timer(dueTime: TimeSpan.FromSeconds(provideClockInterval), period: TimeSpan.FromSeconds(provideClockInterval)) .Subscribe(_ => { canProvideClock = true; } ).AddTo(this); }