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); }
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); }
public static float GetOrigin(BonusTypeEnum type) { if (IsTimeType(type)) { return(0f); } return(1f); }
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); }
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); }
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.##"))); }
public static string FormatToBonus(BonusTypeEnum type, float val) { if (IsTimeType(type)) { return(val.ToString("0.##")); } return(Mathf.Abs(val * 100f - 100f).ToString("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)); }
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)); }
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)); }
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); }
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"); }
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); } }
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); }
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); } }
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); }
public Bonus(Rectangle rect, BonusTypeEnum bonus) { this.Y = rect.Y; this.position = rect; this.type = bonus; }
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)); }
public static string GetAttributeText(BonusTypeEnum type, float val) { string text = FormatToBonus(type, val); return(PersistentSingleton <LocalizationService> .Instance.Text("Attribute." + type, text)); }
public static Func <float, float> CreateIdentityFunc(BonusTypeEnum type) { return((float a) => GetOrigin(type)); }
public static UniRx.IObservable <float> CreateOrigin(BonusTypeEnum type) { return(Observable.Return(GetOrigin(type))); }
private string GetMilestoneString(BonusTypeEnum bonusType, float amount) { return(BonusTypeHelper.GetAttributeText(bonusType, amount)); }