Пример #1
0
        public void Configure(ShieldConfig config)
        {
            ShieldConfig          = config;
            SpriteRenderer.sprite = config.Sprite;
            CurrentEnergy         = config.Energy;

            OnChangeEnergyEvent?.Invoke();
        }
Пример #2
0
        public void IncreaseEnergy(int value)
        {
            int valueToIncrease = Mathf.Abs(value);

            if (!gameObject.activeInHierarchy)
            {
                gameObject.SetActive(true);
                LeanTween.alpha(gameObject, 0, 0);
                LeanTween.alpha(gameObject, 1, 1);
            }

            CurrentEnergy += value;
            if (CurrentEnergy > MaxEnergy)
            {
                CurrentEnergy = MaxEnergy;
            }
            OnChangeEnergyEvent?.Invoke();
            return;
        }
Пример #3
0
 public void DecreaseEnergy(int value)
 {
     if (!_Indestructible)
     {
         int valueToDecrease = Mathf.Abs(value);
         CurrentEnergy -= valueToDecrease;
         LeanTween.alpha(gameObject, 0.6f, 0.04f).setLoopPingPong(Random.Range(2, 8));
         //LeanTween.alpha(gameObject, 1, 1);
         if (CurrentEnergy <= 0)
         {
             CurrentEnergy = 0;
             gameObject.SetActive(false);
         }
         else
         {
             Coroutiner.Start(Cooldown());
         }
         OnChangeEnergyEvent?.Invoke();
     }
     return;
 }