Example #1
0
        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);
        }
Example #2
0
        void Start()
        {
            IFruitsPunchInGameProperties ingameProperties = FruitsPunchManager.Instance;

            Initialize(ingameProperties);

            Observable.EveryUpdate()
            .Where(x => waitTimeForNextDelete > 0)
            .Select(x => Time.deltaTime)
            .Subscribe(x => waitTimeForNextDelete -= x)
            .AddTo(gameObject);
        }
Example #3
0
 void Initialize(IFruitsPunchInGameProperties properties)
 {
     this._timeToFinishFever      = properties.TimeToFinishFever;
     this._gainFeverForEachDelete = properties.GainFeverForEachDelete;
 }
Example #4
0
 void Initialize(IFruitsPunchInGameProperties properties)
 {
     this._gapTimeBetweenDelete = properties.GapTimeBetweenDelete;
 }