LAPTOP-OM1V99U2\永远de小亡灵 1 vuosi sitten
vanhempi
commit
a88e0dd9b5
1 muutettua tiedostoa jossa 22 lisäystä ja 21 poistoa
  1. 22 21
      ActionTowerDefense/Assets/Scripts/PlayerController.cs

+ 22 - 21
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -294,44 +294,45 @@ public class PlayerController : MoveCharacter
         transform.position = new Vector3(142 + 4 * playerId, 0, 0);
         playerRope.playerId = playerId;
         sprintLinkTrigger.playerID = playerId;
-        if (PlayersInput.instance[1] == PlayersInput.instance[0])
-        {
-            PlayersInput.instance[1] = this;
-            PlayerController p1 = PlayersInput.instance[0];
-            mpReplySpeed = mpReplySpeed_2Players;
-            p1.mpReplySpeed = mpReplySpeed_2Players;
-            totalMp = totalMp_2Players;
-            p1.totalMp = totalMp_2Players;
-            if(mp > totalMp)
-            {
-                mp = totalMp;
-            }
-            if(p1.mp > totalMp)
-            {
-                p1.mp = totalMp;
-            }
-            uiMp.Show(mp, totalMp);
-            p1.uiMp.Show(p1.mp, totalMp);
-        }
-        PlayersInput.instance[playerId] = this;
-        skeletonMecanim.skeletonDataAsset = playerSpine[playerId];
         switch (playerId)
         {
             case 0:
+                PlayersInput.instance[0] = this;
+                PlayersInput.instance[1] = this;
                 SpiritSystem.isP1Out = true;
                 SpiritSystem.isP1In = false;
                 SpiritSystem.player1 = gameObject;
                 SpiritSystem.p1Spirits = GetComponent<Spirits>();
                 break;
             case 1:
+                PlayersInput.instance[1] = this;
                 SpiritSystem.isP2Out = true;
                 SpiritSystem.isP2In = false;
                 SpiritSystem.player2 = gameObject;
                 SpiritSystem.p2Spirits = GetComponent<Spirits>();
+
+                //切换为双人计算蓝量方式
+                PlayerController p1 = PlayersInput.instance[0];
+                mpReplySpeed = mpReplySpeed_2Players;
+                p1.mpReplySpeed = mpReplySpeed_2Players;
+                totalMp = totalMp_2Players;
+                p1.totalMp = totalMp_2Players;
+                if (mp > totalMp)
+                {
+                    mp = totalMp;
+                }
+                if (p1.mp > totalMp)
+                {
+                    p1.mp = totalMp;
+                }
+                uiMp.Show(mp, totalMp);
+                p1.uiMp.Show(p1.mp, totalMp);
                 break;
             default:
                 break;
         }
+        skeletonMecanim.skeletonDataAsset = playerSpine[playerId];
+
 
 
         //else