Prechádzať zdrojové kódy

召唤使魔不会收集屏幕内魂,魂自动上飘

wulifu 1 rok pred
rodič
commit
9c26e4cd18

+ 1 - 1
ActionTowerDefense/Assets/Resources/Prefab/soul.prefab

@@ -9847,7 +9847,7 @@ Rigidbody:
   m_Mass: 1
   m_Drag: 0
   m_AngularDrag: 0.05
-  m_UseGravity: 1
+  m_UseGravity: 0
   m_IsKinematic: 0
   m_Interpolate: 0
   m_Constraints: 120

+ 8 - 0
ActionTowerDefense/Assets/Scripts/Soul.cs

@@ -12,6 +12,7 @@ public class Soul : MonoBehaviour
     public int addMp = 10;
     public uTweenPositionTarget tweenPos;
     public float flySpeed = 10f;
+    public float upSpeed = 1;
 
     public void Burst(Vector3 velocity)
     {
@@ -38,4 +39,11 @@ public class Soul : MonoBehaviour
     {
         PlayerController.instance.mp += addMp;
     }
+
+    private void FixedUpdate()
+    {
+        Vector3 velocity = rb.velocity;
+        velocity.y = upSpeed;
+        rb.velocity = velocity;
+    }
 }