// Update is called once per frame void Update() { _stunLeft -= Time.deltaTime; _stunBar.gameObject.SetActive(_value > 0); _stunBar.value = _value; if (IsStunned && OnStun != null) { OnStun.Invoke(); } }
protected virtual bool TryApplyForce(Vector3 force, int power) { if (power >= _knockbackThreshold) { OnKnockback?.Invoke(force, power); return(true); } else if (power >= _stunThreshold) { OnStun?.Invoke(force, power); return(true); } return(false); }