예제 #1
0
 public void StunForSeconds(float seconds, ExplosionArgs explosionArgs)
 {
     if (!IsStunned)
     {
         _physicsComponent.SetRagdollActive(true);
     }
     _onStun?.Invoke();
     _physicsComponent.AddForce(explosionArgs);
     _getUpTime = Time.time + seconds;
     IsStunned  = true;
 }
예제 #2
0
        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);
            }
        }