private void DealDamage(Health targetHealth)
 {
     if (targetHealth)
     {
         int damage = _baseStatsGetter != null ? (int)_baseStatsGetter.GetStat(Stat.Damage) : defaultDamage;
         targetHealth.TakeDamage(damage);
     }
 }
        public void DiePopUpDisplay()
        {
            if (_baseStatsGetter == null || _popUpSpawner == null)
            {
                return;
            }

            _popUpSpawner.PopUpSpawn(_baseStatsGetter.GetStat(Stat.ExperienceReward).ToString());
        }
Ejemplo n.º 3
0
 private IEnumerator CrashDamageCoroutine()
 {
     while (true)
     {
         int damage = _baseStatsGetter != null ? (int)_baseStatsGetter.GetStat(Stat.Damage) : defaultTouchDamagePerPeriod;
         _health.TakeDamage(damage);
         _specialEffectsHandler.PlaySpecialEffectsOnPosition(_contactPoint.point);
         yield return(_crashDamageWaitForSeconds);
     }
 }
Ejemplo n.º 4
0
        private void OnGameLevelUp()
        {
            if (_baseStatsGetter == null)
            {
                return;
            }

            gameLevelBasedTimeToSpawn = _baseStatsGetter.GetStat(Stat.Wildcard);
            gameLevel = _gameLevelController.GameCurrentLevel;
        }
        public void IncreaseHealth(GameObject increaseHealthTo)
        {
            Health _playerHealth = increaseHealthTo.GetComponent <Health>();

            int healthPointsToIncrease = _baseStatsGetter != null
                ? (int)_baseStatsGetter.GetStat(Stat.ExperienceReward)
                : increaseHealthPoints;

            _playerHealth.IncreaseHealth(healthPointsToIncrease);
        }
        public void ExperienceAward()
        {
            if (_baseStatsGetter == null || !_playerMarker)
            {
                return;
            }

            Experience playerExperience = _playerMarker.GetComponent <Experience>();

            playerExperience.GainExperience(_baseStatsGetter.GetStat(Stat.ExperienceReward));
        }
Ejemplo n.º 7
0
        private void OnCollisionEnter2D(Collision2D other)
        {
            if (other.gameObject.tag != "Player")
            {
                return;
            }

            int damage = _baseStatsGetter != null ? (int)_baseStatsGetter.GetStat(Stat.Damage) : defaultExplosionDamage;

            other.gameObject.GetComponent <Health>().TakeDamage(damage);
            onExplosionAttack?.Invoke();
            gameObject.SetActive(false);
        }
Ejemplo n.º 8
0
 public void RestoreInitialHealth()
 {
     health = _baseStatsGetter != null ? (int)_baseStatsGetter.GetStat(Stat.Health) : health;
     OnHealthChange?.Invoke();
 }