示例#1
0
    private void UpdateFrequenciesInStrands()
    {
        if (m_GameStrands == null || m_LastFrequencies == null)
        {
            return;
        }
        int minRewardFrequency = int.MaxValue;
        int maxRewardFrequency = int.MinValue;

        bool frequenciesUpdated = false;

        for (int i = 0; i < m_GameStrands.Count; i++)
        {
            var strand = m_GameStrands[i];
            if (strand == null)
            {
                continue;
            }
            int min, max;
            if (m_LastFrequencies.TryGetRange(i, out min, out max))
            {
                if (strand.MinFreq != min || strand.MaxFreq != max)
                {
                    frequenciesUpdated = true;
                    ((IGameStrand)strand).UpdateFrequencies(min, max);
                }
            }
            if (strand.Strand == StrandType.Reward)
            {
                minRewardFrequency = Mathf.Min(minRewardFrequency, strand.MinFreq);
                maxRewardFrequency = Mathf.Max(maxRewardFrequency, strand.MaxFreq);
            }
        }
        foreach (var strand in m_GameStrands)
        {
            if (strand == null || strand.Strand != StrandType.Inhibit)
            {
                continue;
            }
            ((IGameStrand)strand).SetHighInhibitValue(strand.MinFreq >= maxRewardFrequency);
        }
        if (frequenciesUpdated && m_FrequencyCallbacks != null)
        {
            m_FrequencyCallbacks(m_GameStrands.ToArray());
        }
        LogLayout();
    }