slimecing

a fighting game featuring slimes and swords
Log | Files | Refs | README

RigidbodyDropLogic.cs (610B)


      1 using Slimecing.Swords.Orbitals;
      2 using UnityEngine;
      3 
      4 namespace Slimecing.Swords.DropBehaviour.DropBehaviours
      5 {
      6     public class RigidbodyDropLogic : DropLogic
      7     {
      8         [SerializeField] private Rigidbody rb;
      9         
     10         public override void Drop()
     11         {
     12             base.Drop();
     13             if (rb.isKinematic)
     14             {
     15                 rb.isKinematic = false;
     16             }
     17 
     18             if (!rb.useGravity)
     19             {
     20                 rb.useGravity = true;
     21             }
     22 
     23             rb.constraints = RigidbodyConstraints.None;
     24 
     25             rb.velocity = Vector3.zero;
     26         }
     27     }
     28 }