void Start() { IFruitsPunchInGameProperties ingameProperties = FruitsPunchManager.Instance; Initialize(ingameProperties); Observable.EveryUpdate() .Where(x => IsOnFever) .Select(x => Time.deltaTime / _timeToFinishFever) .Subscribe(x => { feverProgress -= x; if (feverProgress <= 0) { feverProgress = 0f; IsOnFever = false; } }) .AddTo(gameObject); FruitsPunchManager.Instance.DeleteFruitsObservable .Where(x => !IsOnFever && x.Count >= 2) .Subscribe(x => { feverProgress += _gainFeverForEachDelete * x.Count; if (feverProgress > 1f) { feverProgress = 1f; IsOnFever = true; } }) .AddTo(gameObject); }
void Start() { IFruitsPunchInGameProperties ingameProperties = FruitsPunchManager.Instance; Initialize(ingameProperties); Observable.EveryUpdate() .Where(x => waitTimeForNextDelete > 0) .Select(x => Time.deltaTime) .Subscribe(x => waitTimeForNextDelete -= x) .AddTo(gameObject); }
void Initialize(IFruitsPunchInGameProperties properties) { this._timeToFinishFever = properties.TimeToFinishFever; this._gainFeverForEachDelete = properties.GainFeverForEachDelete; }
void Initialize(IFruitsPunchInGameProperties properties) { this._gapTimeBetweenDelete = properties.GapTimeBetweenDelete; }