コード例 #1
0
        private GameObject CreateLevelObject(mg_bc_LevelObject _type)
        {
            GameObject gameObject = null;

            if (_type.Type == "anvil")
            {
                gameObject = GetHazard(mg_bc_EHazardType.HAZARD_ANVIL);
            }
            else if (_type.Type == "flowers")
            {
                gameObject = GetHazard(mg_bc_EHazardType.HAZARD_FLOWERS);
            }
            else if (_type.Type == "fish")
            {
                gameObject = GetHazard(mg_bc_EHazardType.HAZARD_FISH);
            }
            else if (_type.Type == "extra_life")
            {
                gameObject        = GetLifePowerup();
                m_isFlyingPowerup = true;
            }
            else if (_type.Type == "shield")
            {
                gameObject        = GetShieldPowerup();
                m_isFlyingPowerup = true;
            }
            else
            {
                gameObject = GetBag();
            }
            return(gameObject);
        }
コード例 #2
0
        private void ParseLevelXMLObject(XmlNode _xml, mg_bc_Level _level)
        {
            mg_bc_LevelObject mg_bc_LevelObject2 = new mg_bc_LevelObject();

            _level.LevelObjects.Add(mg_bc_LevelObject2);
            mg_bc_LevelObject2.Type = _xml.Attributes["type"].Value;
            mg_bc_LevelObject2.Odds = Convert.ToInt32(_xml.Attributes["odds"].Value);
            _level.TotalObjectOdds += mg_bc_LevelObject2.Odds;
        }
コード例 #3
0
        private GameObject GenerateObjectToSpawn()
        {
            mg_bc_LevelObject mg_bc_LevelObject2 = null;
            float             value = UnityEngine.Random.value;

            if (value <= m_activeLevel.PowerupChance)
            {
                int num = UnityEngine.Random.Range(0, m_activeLevel.TotalPowerUpOdds);
                foreach (mg_bc_LevelObject powerUp in m_activeLevel.PowerUps)
                {
                    if (num < powerUp.Odds && CanSpawn(powerUp.Type))
                    {
                        mg_bc_LevelObject2 = powerUp;
                        break;
                    }
                    num -= powerUp.Odds;
                }
            }
            if (mg_bc_LevelObject2 == null)
            {
                int num = UnityEngine.Random.Range(0, m_activeLevel.TotalObjectOdds);
                foreach (mg_bc_LevelObject levelObject in m_activeLevel.LevelObjects)
                {
                    if (num < levelObject.Odds && CanSpawn(levelObject.Type))
                    {
                        mg_bc_LevelObject2 = levelObject;
                        break;
                    }
                    num -= levelObject.Odds;
                }
            }
            GameObject gameObject = null;

            if (mg_bc_LevelObject2 == null)
            {
                return(GetBag());
            }
            return(CreateLevelObject(mg_bc_LevelObject2));
        }