Example #1
0
    private UniRx.IObservable <float> CreateHeroBonusMultiplier(BonusTypeEnum bonusType, int heroIndex, float mult, int milestone)
    {
        HeroRunner orCreateHeroRunner = Singleton <HeroTeamRunner> .Instance.GetOrCreateHeroRunner(heroIndex);

        return(from level in orCreateHeroRunner.Level
               select(level < milestone) ? BonusTypeHelper.GetOrigin(bonusType) : mult);
    }
Example #2
0
    private UniRx.IObservable <float> CreateGearSetBonusMultiplier(BonusTypeEnum bonusType, int setIndex, float mult)
    {
        GearSetRunner orCreateGearSetRunner = GetOrCreateGearSetRunner(setIndex);

        return(from level in orCreateGearSetRunner.MaxAllLevel
               select(level < 1) ? BonusTypeHelper.GetOrigin(bonusType) : mult);
    }
Example #3
0
 public static float GetOrigin(BonusTypeEnum type)
 {
     if (IsTimeType(type))
     {
         return(0f);
     }
     return(1f);
 }
Example #4
0
 public static Func <float, float, float> CreateFunctionStacking(BonusTypeEnum type)
 {
     if (IsTimeType(type))
     {
         return((float a, float b) => a + b);
     }
     return((float a, float b) => a + b - 1f);
 }
Example #5
0
 public static Func <BigDouble, float, BigDouble> CreateBigDoubleFunction(BonusTypeEnum type)
 {
     if (IsTimeType(type))
     {
         return((BigDouble a, float b) => a + b);
     }
     return((BigDouble a, float b) => a * b);
 }
Example #6
0
 public static string GetStepText(BonusTypeEnum type, float val)
 {
     if (IsTimeType(type))
     {
         return(PersistentSingleton <LocalizationService> .Instance.Text("Attribute.StepDuration", ((!(val > BigDouble.ZERO)) ? string.Empty : "+") + val.ToString("0.##")));
     }
     return(PersistentSingleton <LocalizationService> .Instance.Text("Attribute.StepMultiplier", "+" + Mathf.Abs(val * 100f).ToString("0.##")));
 }
Example #7
0
 public static string FormatToBonus(BonusTypeEnum type, float val)
 {
     if (IsTimeType(type))
     {
         return(val.ToString("0.##"));
     }
     return(Mathf.Abs(val * 100f - 100f).ToString("0.##"));
 }
Example #8
0
    private UniRx.IObservable <float> CreateObservableForAll(BonusTypeEnum bonusType)
    {
        List <UniRx.IObservable <float> > multipliers = (from config in PersistentSingleton <Economies> .Instance.GearSets
                                                         where config.Bonus.BonusType == bonusType
                                                         select CreateGearSetBonusMultiplier(bonusType, config.SetIndex, config.Bonus.Amount)).ToList();

        return(BonusTypeHelper.CreateCombine(bonusType, multipliers));
    }
Example #9
0
    private UniRx.IObservable <BigDouble> CreateObservableForAll(BonusTypeEnum bonusType)
    {
        List <UniRx.IObservable <float> > multipliers = PersistentSingleton <Economies> .Instance.PerkMilestoneConfigs.SelectMany((PerkMilestoneConfig config) => from i in Enumerable.Range(0, config.Items.Count)
                                                                                                                                  where config.Items[i].BonusType == bonusType
                                                                                                                                  select CreateHeroBonusMultiplier(bonusType, config.Hero, config.Items[i].Amount, PersistentSingleton <Economies> .Instance.PerkMilestones[i])).ToList();

        return(from mult in BonusTypeHelper.CreateCombine(bonusType, multipliers)
               select new BigDouble(mult));
    }
Example #10
0
    private UniRx.IObservable <float> CreateObservableForAll(BonusTypeEnum bonusType)
    {
        List <UniRx.IObservable <float> > mult = (from config in PersistentSingleton <Economies> .Instance.Gears
                                                  where config.Boost1.Mult.BonusType == bonusType
                                                  select Singleton <GearCollectionRunner> .Instance.GetOrCreateGearRunner(config.GearIndex).Boost1Amount.AsObservable()).ToList();
        List <UniRx.IObservable <float> > mult2 = (from config in PersistentSingleton <Economies> .Instance.Gears
                                                   where config.Boost2.Mult.BonusType == bonusType
                                                   select Singleton <GearCollectionRunner> .Instance.GetOrCreateGearRunner(config.GearIndex).Boost2Amount.AsObservable()).ToList();

        return(BonusTypeHelper.CreateCombineStacking(bonusType, mult, mult2));
    }
Example #11
0
    public static UniRx.IObservable <float> CreateCombine(BonusTypeEnum type, List <UniRx.IObservable <float> > multipliers)
    {
        Func <float, float, float> func = CreateFunction(type);

        UniRx.IObservable <float> observable = CreateOrigin(type);
        foreach (UniRx.IObservable <float> multiplier in multipliers)
        {
            observable = observable.CombineLatest(multiplier, (float left, float right) => func(left, right));
        }
        return(observable);
    }
Example #12
0
        public virtual IBonus CreateBonusFactory(BonusTypeEnum type, IDbConnectionFactory conn)
        {
            switch (type)
            {
            case BonusTypeEnum.WelcomeBonus:
                return(new WelcomeBonus(conn));

            default:
                throw new Exception("Invalid");
            }
            throw new Exception("Invalid");
        }
Example #13
0
 public void SetBonusType(BonusTypeEnum bonusType)
 {
     BonusType = bonusType;
     if (BonusType == BonusTypeEnum.None)
     {
         return;
     }
     if (BonusType == BonusTypeEnum.ChangeCravityBonus)
     {
         Vector3 pos = new Vector3(transform.position.x, transform.position.y, -0.5f);
         Instantiate(changeGravityBonusSpritePrefab, pos, Quaternion.identity, transform);
     }
 }
Example #14
0
    private BigDouble GetDamageMult(BonusTypeEnum bonusId, int heroIndex, int level)
    {
        List <BonusMultConfig> items = PersistentSingleton <Economies> .Instance.PerkMilestoneConfigs[heroIndex].Items;
        BigDouble bigDouble          = new BigDouble(1.0);

        for (int i = 0; i < items.Count && PersistentSingleton <Economies> .Instance.PerkMilestones[i] <= level; i++)
        {
            if (items[i].BonusType == bonusId)
            {
                bigDouble *= items[i].Amount;
            }
        }
        return(bigDouble);
    }
Example #15
0
    public static bool IsTimeType(BonusTypeEnum type)
    {
        switch (type)
        {
        case BonusTypeEnum.BossTime:
        case BonusTypeEnum.SkillAutoMineDuration:
        case BonusTypeEnum.SkillTeamBoostDuration:
        case BonusTypeEnum.SkillTapBoostDuration:
        case BonusTypeEnum.SkillGoldfingerDuration:
            return(true);

        default:
            return(false);
        }
    }
Example #16
0
    public static UniRx.IObservable <float> CreateCombineStacking(BonusTypeEnum type, List <UniRx.IObservable <float> > mult1, List <UniRx.IObservable <float> > mult2)
    {
        Func <float, float, float> func = CreateFunctionStacking(type);

        UniRx.IObservable <float> observable = CreateOrigin(type);
        foreach (UniRx.IObservable <float> item in mult1)
        {
            observable = observable.CombineLatest(item, (float left, float right) => func(left, right));
        }
        foreach (UniRx.IObservable <float> item2 in mult2)
        {
            observable = observable.CombineLatest(item2, (float left, float right) => func(left, right));
        }
        return(observable);
    }
Example #17
0
 public Bonus(Rectangle rect, BonusTypeEnum bonus)
 {
     this.Y        = rect.Y;
     this.position = rect;
     this.type     = bonus;
 }
Example #18
0
 private UniRx.IObservable <Func <float, float> > CreateGearBonusObservable(BonusTypeEnum bonusType, float levelUpAmount)
 {
     return(from lvl in Level
            select(lvl > 0) ? CreateGearBonusOperator(lvl - 1, levelUpAmount) : BonusTypeHelper.CreateIdentityFunc(bonusType));
 }
Example #19
0
    public static string GetAttributeText(BonusTypeEnum type, float val)
    {
        string text = FormatToBonus(type, val);

        return(PersistentSingleton <LocalizationService> .Instance.Text("Attribute." + type, text));
    }
Example #20
0
 public static Func <float, float> CreateIdentityFunc(BonusTypeEnum type)
 {
     return((float a) => GetOrigin(type));
 }
Example #21
0
 public static UniRx.IObservable <float> CreateOrigin(BonusTypeEnum type)
 {
     return(Observable.Return(GetOrigin(type)));
 }
Example #22
0
 private string GetMilestoneString(BonusTypeEnum bonusType, float amount)
 {
     return(BonusTypeHelper.GetAttributeText(bonusType, amount));
 }