示例#1
0
        private void CalculateNextPowerUp()
        {
            mg_ss_ItemGeneratorWeightingData mg_ss_ItemGeneratorWeightingData2 = CalculateRandomWeighting(m_generationData.PowerUpData.PowerUps);

            if (mg_ss_ItemGeneratorWeightingData2 != null)
            {
                QueuePowerUp(mg_ss_ItemGeneratorWeightingData2);
            }
        }
示例#2
0
        private void QueuePowerUp(mg_ss_ItemGeneratorWeightingData p_weighting)
        {
            mg_ss_EItemTypes mg_ss_EItemTypes2 = mg_ss_ItemGeneratorData.CalculateItemType(p_weighting.Tag);

            if (mg_ss_EItemTypes2 != mg_ss_EItemTypes.NULL)
            {
                m_queuedPowerups.Enqueue(mg_ss_EItemTypes2);
                m_powerUpCooldown = m_generationData.PowerUpData.SpawnCooldown;
            }
        }
        private void LoadWeightings(XmlElement p_xmlTier, mg_ss_ItemGeneratorData p_data)
        {
            XmlNode xmlNode = p_xmlTier.SelectSingleNode("weightings");

            foreach (XmlElement item in xmlNode.ChildNodes.OfType <XmlElement>())
            {
                mg_ss_ItemGeneratorWeightingData mg_ss_ItemGeneratorWeightingData2 = new mg_ss_ItemGeneratorWeightingData();
                mg_ss_Resources.LoadXMLClass(mg_ss_ItemGeneratorWeightingData2, item);
                p_data.Weightings.Add(mg_ss_ItemGeneratorWeightingData2);
            }
        }
示例#4
0
        private void QueueTierItem(float p_delay)
        {
            mg_ss_ItemGeneratorWeightingData mg_ss_ItemGeneratorWeightingData2 = CalculateRandomWeighting(m_generationData.Weightings);

            if (mg_ss_ItemGeneratorWeightingData2 != null)
            {
                QueueFromWeighting(mg_ss_ItemGeneratorWeightingData2, p_delay);
            }
            else
            {
                QueueRandomFruit(p_delay);
            }
        }
        private void LoadPowerUps(XmlElement p_xmlTier, mg_ss_ItemGeneratorData p_data)
        {
            XmlNode xmlNode = p_xmlTier.SelectSingleNode("powerups");

            if (xmlNode == null)
            {
                return;
            }
            mg_ss_Resources.LoadXMLClass(p_data.PowerUpData, xmlNode);
            foreach (XmlElement item in xmlNode.ChildNodes.OfType <XmlElement>())
            {
                mg_ss_ItemGeneratorWeightingData mg_ss_ItemGeneratorWeightingData2 = new mg_ss_ItemGeneratorWeightingData();
                mg_ss_Resources.LoadXMLClass(mg_ss_ItemGeneratorWeightingData2, item);
                p_data.PowerUpData.PowerUps.Add(mg_ss_ItemGeneratorWeightingData2);
            }
        }
示例#6
0
        private void QueueFromWeighting(mg_ss_ItemGeneratorWeightingData p_weightingData, float p_delay)
        {
            mg_ss_EItemTypes mg_ss_EItemTypes2 = mg_ss_ItemGeneratorData.CalculateItemType(p_weightingData.Tag);

            if (mg_ss_EItemTypes2 == mg_ss_EItemTypes.NULL)
            {
                QueueRandomFruit(p_delay);
            }
            else if (p_weightingData.BounceVelocity > 0f)
            {
                SpawnItem_Bounce(mg_ss_EItemTypes2, p_delay, p_weightingData.BounceVelocity);
            }
            else
            {
                SpawnItem_Linear(mg_ss_EItemTypes2, p_delay);
            }
        }
示例#7
0
        private mg_ss_ItemGeneratorWeightingData CalculateRandomWeighting(List <mg_ss_ItemGeneratorWeightingData> p_weightingList)
        {
            mg_ss_ItemGeneratorWeightingData result = null;
            int num = 0;

            foreach (mg_ss_ItemGeneratorWeightingData p_weighting in p_weightingList)
            {
                num += p_weighting.Weighting;
            }
            int num2 = Random.Range(0, num + 1);

            foreach (mg_ss_ItemGeneratorWeightingData p_weighting2 in p_weightingList)
            {
                if (num2 <= p_weighting2.Weighting)
                {
                    result = p_weighting2;
                    break;
                }
                num2 -= p_weighting2.Weighting;
            }
            return(result);
        }