Exemplo n.º 1
0
    public void DropBonus()
    {
        if (!TrainingHandler.IsTrainingFinished())
        {
            if (
                !MonobehaviorHandler.GetMonobeharior()
                .GetObject <TrainingHandler>("TrainingHandler")
                .IsBonusDropEnabled())
            {
                return;
            }
        }
        if (MonobehaviorHandler.GetMonobeharior()
            .GetObject <BonusTimer>("bonusTimer")
            .IsAnyBonusActive())
        {
            return;
        }
        if (!Randomizer.GetPercentageBasedBoolean((int)_passenger.BonusProbability))
        {
            return;
        }
        GameController.BonusTypes bonusType = Randomizer.CalculateValue <GameController.BonusTypes>(_passenger.BonusProbabilities);
        IBonus drop = null;

        switch (bonusType)
        {
        case GameController.BonusTypes.Wheel:
            drop = new WheelBonus();
            break;

        case GameController.BonusTypes.Ticket:
            drop = new TicketBonus();
            break;

        case GameController.BonusTypes.Boot:
            drop = new BootBonus();
            break;

        case GameController.BonusTypes.Magnet:
            drop = new MagnetBonus();
            break;

        case GameController.BonusTypes.Smile:
            drop = new SmileBonus();
            break;

        case GameController.BonusTypes.AntiHare:
            drop = new AntiHareBonus();
            break;

        case GameController.BonusTypes.SandGlass:
            drop = new SandGlassBonus();
            break;

        case GameController.BonusTypes.Vortex:
            drop = new VortexBonus();
            break;

        case GameController.BonusTypes.Snow:
            drop = new SnowBonus();
            break;

        case GameController.BonusTypes.Wrench:
            drop = new WrenchBonus();
            break;

        case GameController.BonusTypes.Cogwheel:
            break;

        case GameController.BonusTypes.Heal:
            drop = new HealBonus();
            break;

        default:
            return;
        }
        if (!TrainingHandler.IsTrainingFinished())
        {
            TrainingHandler handler = MonobehaviorHandler.GetMonobeharior()
                                      .GetObject <TrainingHandler>("TrainingHandler");
            if (handler.IsDropTypeLocked())
            {
                drop = new AntiHareBonus();
            }
        }
        if (drop != null)
        {
            MonobehaviorHandler.GetMonobeharior()
            .GetObject <BonusTimer>("bonusTimer").DropBonus(drop, _passenger.transform.position);
        }
    }
Exemplo n.º 2
0
 public void DropBonus()
 {
     if (!TrainingHandler.IsTrainingFinished())
     {
         if (
             !MonobehaviorHandler.GetMonobeharior()
                 .GetObject<TrainingHandler>("TrainingHandler")
                 .IsBonusDropEnabled())
         {
             return;
         }
     }
     if (MonobehaviorHandler.GetMonobeharior()
             .GetObject<BonusTimer>("bonusTimer")
             .IsAnyBonusActive())
         return;
     if (!Randomizer.GetPercentageBasedBoolean((int)_passenger.BonusProbability))
         return;
     GameController.BonusTypes bonusType = Randomizer.CalculateValue<GameController.BonusTypes>(_passenger.BonusProbabilities);
     IBonus drop = null;
     switch (bonusType)
     {
         case GameController.BonusTypes.Wheel:
             drop = new WheelBonus();
             break;
         case GameController.BonusTypes.Ticket:
             drop = new TicketBonus();
             break;
         case GameController.BonusTypes.Boot:
             drop = new BootBonus();
             break;
         case GameController.BonusTypes.Magnet:
             drop = new MagnetBonus();
             break;
         case GameController.BonusTypes.Smile:
             drop = new SmileBonus();
             break;
         case GameController.BonusTypes.AntiHare:
             drop = new AntiHareBonus();
             break;
         case GameController.BonusTypes.SandGlass:
             drop = new SandGlassBonus();
             break;
         case GameController.BonusTypes.Vortex:
             drop = new VortexBonus();
             break;
         case GameController.BonusTypes.Snow:
             drop = new SnowBonus();
             break;
         case GameController.BonusTypes.Wrench:
             drop = new WrenchBonus();
             break;
         case GameController.BonusTypes.Cogwheel:
             break;
         case GameController.BonusTypes.Heal:
             drop = new HealBonus();
             break;
         default:
             return;
     }
     if (!TrainingHandler.IsTrainingFinished())
     {
         TrainingHandler handler = MonobehaviorHandler.GetMonobeharior()
             .GetObject<TrainingHandler>("TrainingHandler");
         if (handler.IsDropTypeLocked())
         {
             drop = new AntiHareBonus();
         }
         
     }
         if (drop != null)
     {
         MonobehaviorHandler.GetMonobeharior()
             .GetObject<BonusTimer>("bonusTimer").DropBonus(drop, _passenger.transform.position);
     }
 }