public void StunForSeconds(float seconds, ExplosionArgs explosionArgs) { if (!IsStunned) { _physicsComponent.SetRagdollActive(true); } _onStun?.Invoke(); _physicsComponent.AddForce(explosionArgs); _getUpTime = Time.time + seconds; IsStunned = true; }
public void AddForce(ExplosionArgs args) { if (!IsRagdollActive) { return; } foreach (var rb in _rigidbodies) { var forceVector = (rb.position - args.ExplosionPosition).normalized; forceVector.y = args.Upwards; forceVector *= args.Force; rb.AddForce(forceVector); } }