// Set one effect on public void RandomEffect() { int rngEffectId = Random.Range(0, Effects.Count); StartDistortion(); while (true) { rngEffectId = Random.Range(0, Effects.Count); if (Effects.IndexOf(CurrentEffect) == rngEffectId) { var nextID = Effects.IndexOf(CurrentEffect) + 1; rngEffectId = nextID == Effects.Count ? 0 : nextID; } if (Random.value < Effects[rngEffectId].chance) { break; } } Debug.Log(Effects[rngEffectId].chance); CurrentEffect = Effects[rngEffectId]; CurrentEffect.StartEffect(); StartCoroutine(EffectWai(randomInterval / 2)); }
public void NextPickUpEffect() { int pickUpCount = Random.Range(0, PickUpEffects.Count - 1); CurrentPickupEffect = PickUpEffects[pickUpCount]; CurrentPickupEffect.StartEffect(); StartCoroutine(PickUpEffectWai(5)); }
public IBoostEffect CreateBoostBuff(int boostType, int last, int point, int percent, params int[] buffIds) { var boost = new BoostEffect(RootSkill, buffIds, (EnumBoostType)boostType, false, false, false); boost.Point = point; boost.Percent = percent; boost.Last = last; boost.TimeEnd = (short)last; boost.Repeat = 0; boost.Recycle = false; return(boost); }
public void NextEffect() { if (CurrentEffect != null) { CurrentEffect.EndEffect(); var nextID = Effects.IndexOf(CurrentEffect) + 1; Debug.Log(nextID); EffectId = nextID == Effects.Count ? 0 : nextID; } CurrentEffect = Effects[EffectId]; CurrentEffect.StartEffect(); }