private void BonusMissedHandler(Bonus bonus, BonusCollection collection)
 {
     if (bonus.GetType() == Type.GetType("LevelGeneration." + obsevableBonusType))
     {
         HandleBonusMissed(bonus, collection);
     }
 }
Beispiel #2
0
 public void CollectionInitializedEvent(BonusCollection collection)
 {
     if (CollectionInitialized != null)
     {
         CollectionInitialized(collection);
     }
 }
Beispiel #3
0
 public void BonusMissedEvent(Bonus bonus, BonusCollection collection)
 {
     if (BonusMissed != null)
     {
         BonusMissed(bonus, collection);
     }
 }
        void AddingBonusesStackVariousTest()
        {
            Bonus           bonus1          = new Bonus(12, sourceFactory.Create("name", true));
            Bonus           bonus2          = new Bonus(4, sourceFactory.Create("otherName", false));
            BonusCollection bonusCollection = new BonusCollection();

            bonusCollection.Add(bonus1);
            bonusCollection.Add(bonus2);
            Assert.Equal(bonus1.NumericValue + bonus2.NumericValue, bonusCollection.Sum());
        }
Beispiel #5
0
 public override void HandleBonusCollected(Bonus bonus, BonusCollection collection)
 {
     if (countOfCoins == null)
     {
         Debug.Log("countOfCoins==null in" + gameObject.name);
     }
     else
     {
         countOfCoins.Text = GetCorrectText(collection.score);
     }
 }
        void AddingBonusesNotStackTest()
        {
            Source          source          = sourceFactory.Create("otherName", false);
            Bonus           bonus1          = new Bonus(12, source);
            Bonus           bonus2          = new Bonus(4, source);
            BonusCollection bonusCollection = new BonusCollection();

            bonusCollection.Add(bonus1);
            bonusCollection.Add(bonus2);
            Assert.Equal(Math.Max(bonus1.NumericValue, bonus2.NumericValue), bonusCollection.Sum());
        }
        void AddingBonusesStackSameTest()
        {
            Source          source          = sourceFactory.Create("name", true);
            Bonus           bonus1          = new Bonus(12, source);
            Bonus           bonus2          = new Bonus(4, source);
            BonusCollection bonusCollection = new BonusCollection();

            bonusCollection.Add(bonus1);
            bonusCollection.Add(bonus2);
            Assert.Equal(bonus1.NumericValue + bonus2.NumericValue, bonusCollection.Sum());
        }
Beispiel #8
0
        public void PlayClip(Bonus bonus, BonusCollection bonuses)
        {
            if (audioSource)
            {
                audioSource.loop = false;
                if (bonus is Coin)
                {
                    audioSource.clip = SoundUtils.getRandomAudioClip(Coins);
                }
                else if (bonus is CoinMultiplier)
                {
                    audioSource.clip = CoinMultiplier;
                }
                else if (bonus is CrazyBattery)
                {
                    audioSource.clip = CrazyBattery;
                }
                else if (bonus is CreditCard)
                {
                    audioSource.clip = CreditCard;
                }
                else if (bonus is HalfBattery)
                {
                    audioSource.clip = HalfBattery;
                }
                else if (bonus is Magnet)
                {
                    audioSource.clip = Magnet;
                }
                else if (bonus is Medikit)
                {
                    audioSource.clip = Medkit;
                }
                else if (bonus is MemoryCard)
                {
                    audioSource.clip = MemeoryCard;
                }
                else if (bonus is SuperMedikit)
                {
                    audioSource.clip = SuperMedkit;
                }


                if (audioSource.clip != null)
                {
                    audioSource.Play();
                }
            }
        }
Beispiel #9
0
 public override void JustUpdate(BonusCollection collection)
 {
 }
Beispiel #10
0
    public override void HandleBonusMissed(Bonus bonus, BonusCollection collection)
    {
        dfControl magnetGUI = GetComponent <dfControl>();

        magnetGUI.Hide();
    }
 public abstract void JustUpdate(BonusCollection collection);
 public abstract void HandleBonusMissed(Bonus bonus, BonusCollection collection);