Beispiel #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);
        }
Beispiel #2
0
        private void RemoveEmitterDestroyedListener(PrefabToggleOpener spawnSite)
        {
            TimedEmitter emitter = spawnSite.FindEmitter();

            if (emitter == null)
            {
                return;
            }

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

            if (emitter == null)
            {
                return;
            }

            emitter.OnProgressChanged -= m_OnProgressChanged;
        }
        private void IncrementNumEmissions(TimedEmitter emitter, GameObject clone)
        {
            if (!StartsWith(clone == null ? null : clone.name, m_CloneNamePrefix))
                return;

            if (!StartsWith(emitter.StatsCategory, m_EmitterCategoryPrefix))
                return;

            m_NumEmissions++;
            string emitterName = TrimSuffix(emitter.name, "(Clone)");
            AddAmount(m_CountPerTopEmitterNames, emitterName, 1);

            UpdateAverageRateOfEmissions();
        }
        private void EmitPackage(TravelerData traveler)
        {
            if (traveler != m_Traveler.Data)
            {
                return;
            }

            GameObject package = (GameObject)Instantiate(m_TimedEmitterPackage.gameObject,
                                                         traveler.position, Quaternion.identity);
            TimedEmitter emitterInPackage = package.GetComponent <TimedEmitter>();
            Site         site             = m_Path[m_PathIndex];

            emitterInPackage.PrefabToSpawn = site.packageContent;

            SetDestination(++m_PathIndex);
        }
Beispiel #6
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;
        }
        private void AttractEmission(Emission emission)
        {
            float change = GetChange(emission.Type);

            if (change == 0f)
            {
                return;
            }

            Vector2      destination = m_Lerper == null ? transform.position : m_Lerper.transform.position;
            float        duration    = TravelerView.SetDestination(emission.gameObject, destination);
            TimedEmitter emitter     = emission.GetComponent <TimedEmitter>();

            if (emitter == null)
            {
                return;
            }

            emitter.RateOverTime = duration;
        }
Beispiel #8
0
        /// <summary>
        /// Strangely, the emitters appear equal but are different.
        /// </summary>
        private void CloseIfEmitterNamesAreEqual(TimedEmitter otherEmitter)
        {
            if (m_SpawnSite == null)
            {
                return;
            }

            TimedEmitter emitter = m_SpawnSite.FindEmitter();

            if (emitter == null)
            {
                return;
            }

            if (emitter.name != otherEmitter.name)
            {
                return;
            }

            Close();
        }