瀏覽代碼

双人捡魂

LAPTOP-OM1V99U2\永远de小亡灵 1 年之前
父節點
當前提交
b3e3b5f943
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 2 2
      ActionTowerDefense/Assets/Scripts/Soul.cs
  2. 1 1
      ActionTowerDefense/Assets/Scripts/SoulCollector.cs

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Soul.cs

@@ -21,12 +21,12 @@ public class Soul : MonoBehaviour
         collected = false;
     }
 
-    public async void BeCollect()
+    public async void BeCollect(int id)
     {
         rb.isKinematic = true;
         collected = true;
         tweenPos.from = transform;
-        tweenPos.to = PlayersInput.instance[0].transform;
+        tweenPos.to = PlayersInput.instance[id].transform;
         tweenPos.duration = (tweenPos.from.position - tweenPos.to.position).magnitude / flySpeed;
         tweenPos.ResetToBeginning();
         tweenPos.PlayForward();

+ 1 - 1
ActionTowerDefense/Assets/Scripts/SoulCollector.cs

@@ -16,7 +16,7 @@ public class SoulCollector : MonoBehaviour
         Soul soul = other.GetComponentInParent<Soul>();
         if (soul)
         {
-            soul.BeCollect();
+            soul.BeCollect(player.playerId);
         }
     }
 }