Esempio n. 1
0
        public bool applyBonus(Bonus.BonusType type, Vector3 bonusPosition)
        {
            if (type == Bonus.BonusType.End)
            {
                if (keysLeft > 0)
                {
                    return false;
                }
                parentGaming.levelCleared();

            }

            if (type == Bonus.BonusType.Key)
            {
                this.keysLeft--;
            }
            if (type == Bonus.BonusType.Live)
            {
                this.lives++;
            }

            if (type == Bonus.BonusType.Score)
            {
                this.score += 1000;
            }

            if (type == Bonus.BonusType.Save)
            {
                this.Home = bonusPosition;
            }

            return true;
        }
Esempio n. 2
0
        protected void setBonuses()
        {
            StreamReader sr = new StreamReader(this.name + " " + "bonusesData.txt");
              bonuses = new Dictionary<int, Bonus>();

              int i = 1;
               while (!sr.EndOfStream)
               {
                   String line = sr.ReadLine();
                   String[] properties = line.Split(new Char[] { '\n', ' ' });
                   Vector3 position = new Vector3(
                     (float)Convert.ToDouble(properties[1]),
                     (float)Convert.ToDouble(properties[2]),
                     (float)Convert.ToDouble(properties[3])
                     );

                   Bonus newBonus = new Bonus(position, properties[0]);
                   newBonus.model = loadModel(properties[0]);
                   if (newBonus.type == Bonus.BonusType.Key)
                   {
                       this.ball.keysLeft++;
                   }

                   bonuses[i] = newBonus;
                   i++;
               }
        }