Example #1
0
        private void AddProgressListener(PrefabToggleOpener spawnSite, PrefabToggle[] prefabToggles)
        {
            TimedEmitter emitter = spawnSite.FindEmitter();

            if (emitter == null)
            {
                return;
            }

            UpdateFill(emitter.Progress);

            if (m_OnProgressChanged == null)
            {
                m_OnProgressChanged = UpdateFill;
            }

            emitter.OnProgressChanged -= m_OnProgressChanged;
            emitter.OnProgressChanged += m_OnProgressChanged;

            if (m_FillRoot == null)
            {
                return;
            }

            PrefabToggle selectedToggle = prefabToggles[spawnSite.SelectedIndex];

            m_FillRoot.SetParent(selectedToggle.transform, false);
        }
Example #2
0
        public void Open(PrefabToggleOpener spawnSite)
        {
            Close();

            m_SpawnSite = spawnSite;
            PopulateToggles(spawnSite.OptionsToSpawn, spawnSite.SelectedIndex, m_Toggles);
            AddProgressListener(spawnSite, m_Toggles);
            AddEmitterDestroyedListener(spawnSite);
            gameObject.SetActive(true);
        }
Example #3
0
        private void RemoveEmitterDestroyedListener(PrefabToggleOpener spawnSite)
        {
            TimedEmitter emitter = spawnSite.FindEmitter();

            if (emitter == null)
            {
                return;
            }

            TimedEmitter.OnDestroyed -= m_OnEmitterDestroyed;
        }
Example #4
0
        private void RemoveProgressListener(PrefabToggleOpener spawnSite)
        {
            TimedEmitter emitter = spawnSite.FindEmitter();

            if (emitter == null)
            {
                return;
            }

            emitter.OnProgressChanged -= m_OnProgressChanged;
        }
Example #5
0
        private void AddEmitterDestroyedListener(PrefabToggleOpener spawnSite)
        {
            TimedEmitter emitter = spawnSite.FindEmitter();

            if (emitter == null)
            {
                Close();
                return;
            }

            if (m_OnEmitterDestroyed == null)
            {
                m_OnEmitterDestroyed = CloseIfEmitterNamesAreEqual;
            }

            TimedEmitter.OnDestroyed -= m_OnEmitterDestroyed;
            TimedEmitter.OnDestroyed += m_OnEmitterDestroyed;
        }