瀏覽代碼

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

wulifu 1 年之前
父節點
當前提交
9c26e4cd18
共有 2 個文件被更改,包括 9 次插入1 次删除
  1. 1 1
      ActionTowerDefense/Assets/Resources/Prefab/soul.prefab
  2. 8 0
      ActionTowerDefense/Assets/Scripts/Soul.cs

+ 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;
+    }
 }