ソースを参照

双人捡魂回蓝,放怪

LAPTOP-OM1V99U2\永远de小亡灵 1 年間 前
コミット
ce95abb637

+ 6 - 4
ActionTowerDefense/Assets/Scripts/Demonic.cs

@@ -13,14 +13,16 @@ public class Demonic : MoveCharacter
     public bool canFly = false;
     public int sortingOrder = 0;
 
+    public int playerID;
+
     private void Awake()
     {
-        
+
     }
 
     private void OnDisable()
     {
-        PlayersInput.instance[0].OnDemonicRecycle(this);
+        PlayersInput.instance[playerID].OnDemonicRecycle(this);
     }
 
     public override void FixedUpdate()
@@ -426,7 +428,7 @@ public class Demonic : MoveCharacter
                 dieKeepTime = totalDieKeepTime;
                 //接尸体存入动效
                 //友方死亡后计入尸体
-                PlayersInput.instance[0].corpses++;
+                PlayersInput.instance[playerID].corpses++;
                 //print(PlayersInput.instance[0].corpses);
                 break;
             case CharacterState.Weak:
@@ -446,7 +448,7 @@ public class Demonic : MoveCharacter
     {
         base.Attack1();
         Vector3 moveDir;
-        if (PlayersInput.instance[0].bodyTrans.localScale.x > 0)
+        if (PlayersInput.instance[playerID].bodyTrans.localScale.x > 0)
         {
             moveDir = Vector3.left;
         }

+ 1 - 0
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -1137,6 +1137,7 @@ public class PlayerController : MoveCharacter
         GameObject demonicObj = PoolManager.Instantiate(prefab);
         Demonic demonic = demonicObj.GetComponent<Demonic>();
         demonic.id = id;
+        demonic.playerID = playerId;
         if (!demonicDic.ContainsKey(id))
         {
             demonicDic.Add(id, new List<Demonic>());

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

@@ -31,13 +31,13 @@ public class Soul : MonoBehaviour
         tweenPos.ResetToBeginning();
         tweenPos.PlayForward();
         await Task.Delay((int)(tweenPos.duration * 1000));
-        BeGet();
+        BeGet(id);
         gameObject.SetActive(false);
     }
 
-    public void BeGet()
+    public void BeGet(int id)
     {
-        PlayersInput.instance[0].mp += addMp;
+        PlayersInput.instance[id].mp += addMp;
     }
 
     private void FixedUpdate()