コード例 #1
0
        // Update is called once per frame
        void FixedUpdate()
        {
            // Asked to reduce
            if (_reduce)
            {
                _reduceCounter += Time.deltaTime / _animationDuration;
                // if done reducing
                if (_reduceCounter >= 1)
                {
                    var newWidth  = StepsIndex < _stepsNumber ? _lineWidth[StepsIndex] : _small;
                    var newRadius = StepsIndex < _stepsNumber ? _radius[StepsIndex] : _small;
                    DrawCircle(newRadius, newWidth);

                    _reduce        = false;
                    _reduceCounter = 0;
                    OnReduceFinished?.Invoke(this);
                }
                else
                {
                    // reducing
                    var newWidth  = Mathf.Lerp(_currentWidth, StepsIndex < _stepsNumber ? _lineWidth[StepsIndex] : _small, _reduceCounter);
                    var newRadius = Mathf.Lerp(_currentRadius, StepsIndex < _stepsNumber ? _radius[StepsIndex] : _small, _reduceCounter);
                    DrawCircle(newRadius, newWidth);
                }
            }
        }
コード例 #2
0
ファイル: Circle.cs プロジェクト: Empheon/GlobalGameJam2020
 private void ReduceFinished(CircleComponent circleComponent)
 {
     circleComponent.OnReduceFinished -= ReduceFinished;
     foreach (var circle in _circlesToConstruct)
     {
         var cc = circle.GetComponent <CircleComponent>();
         if (cc.OnReduceFinishedEventCountInvocation != null && cc.OnReduceFinishedEventCountInvocation >= 1)
         {
             return;
         }
     }
     OnReduceFinished?.Invoke(this);
 }