//marker on animation tab, just working without calling before public void Hit() { Debug.Log("FIGHTER.HIT GENERAL"); if (target == null) { return; } float damage = GetComponent <BaseStats>().GetStat(Stat.Damage); if (currentWeapon.value != null) { Debug.Log("FIGHTER.HIT VALUE NIE JEST NULL"); currentWeapon.value.OnHit(); } if (currentWeaponConfig.HasProjectile()) { Debug.Log("SPAWN PROJECTILE"); currentWeaponConfig.SpawnProjectile(gameObject, rightHand, leftHand, target, damage); } else { Debug.Log("FIGHTER.HIT PRZED TAKE DAMAGE"); target.TakeDamage(gameObject, damage); } }
//Animation event private void Hit() { if (targetHealth != null) { float damage = GetComponent <BaseStats>().GetStat(Stat.Damage); damage = CalculateDamageSpread(damage); if (currentWeapon != null) { currentWeapon.OnHit(); } if (currentWeaponConfig.HasProjectile()) { currentWeaponConfig.SpawnProjectile(rightHandTransform, leftHandTransform, targetHealth, gameObject, damage); Mana mana = GetComponent <Mana>(); if (mana != null && currentWeaponConfig.ManaCost > 0) { mana.ReduceMana(currentWeaponConfig.ManaCost); if (mana.ManaValue < currentWeaponConfig.ManaCost) { Cancel(); currentWeaponConfig = defaultWeaponConfig; currentWeapon = EquipWeapon(currentWeaponConfig); } } } else { if (targetHealth.GetHealth() > 0) { targetHealth.TakeDamage(gameObject, damage); } } } onHit.Invoke(); }