void StopAttack() { _pControl.disableMovement = false; OnUpdate -= attacks[currentAttack].OnUpdate; attacks[currentAttack].OnAttackEnd -= StopAttack; currentAttack = -1; }
void Damage() { noDamageTimer += Time.deltaTime; if (noDamageTimer > TimeInvulnerable) { _pSystem.Stop(); isDamaged = false; noDamageTimer = 0; OnUpdate -= Damage; } }
public void onAttack(int value) { if (currentAttack != -1 && attacks[currentAttack].isAttackPlaying) { return; } _pControl.disableMovement = true; currentAttack = value; attacks[currentAttack].Start(); OnUpdate += attacks[currentAttack].OnUpdate; attacks[currentAttack].OnAttackEnd += StopAttack; }
public void OnDamaged(float damage, Transform player) { if (!isDamaged && !isBlocking) { _pSystem.Play(); isDamaged = true; _pSystem.maxParticles += (int)(maxParticles + (multiplicator * 10)); multiplicator += damage; Vector3 dir = player.transform.position - _transform.position; _pControl.ScaleCheck(dir); _rigidbody.AddForce(-dir * damage * 1000 * multiplicator); OnUpdate += Damage; } }