Przeglądaj źródła

双人和单人蓝量分开计算

LAPTOP-OM1V99U2\永远de小亡灵 1 rok temu
rodzic
commit
9eb1cb572d

+ 10 - 2
ActionTowerDefense/Assets/Resources/Prefab/Player.prefab

@@ -889,6 +889,10 @@ MonoBehaviour:
   haveTransmit: 0
   transmitTime: 0
   portalsController: {fileID: 0}
+  isSustainedInjury: 0
+  sustainedInjuryTime: 0
+  sustainedInjury_IntervalTime: 0
+  sustainedInjury_damage: 0
   playerId: 0
   canJump: 1
   canfly: 0
@@ -912,10 +916,12 @@ MonoBehaviour:
   - {fileID: 11400000, guid: a1915b92abea4a049a4d50b2ebd53111, type: 2}
   - {fileID: 11400000, guid: b8dcb564f1b91234588d66173ce4064e, type: 2}
   mp: 0
-  totalMp: 300
+  totalMp: 450
+  totalMp_2Players: 300
   isMpRepel: 1
   isRapedReply: 0
-  mpReplySpeed: 10
+  mpReplySpeed: 15
+  mpReplySpeed_2Players: 10
   rapidReplySpeed: 15
   lostMp: 0
   soul: {fileID: 1723151111827507807, guid: e2b65aa482f2f1447a4074208d72b778, type: 3}
@@ -1113,6 +1119,8 @@ MonoBehaviour:
   rb: {fileID: 0}
   haveGravity: 1
   trigGroundList: []
+  myBaGuaTrigger: {fileID: 0}
+  baGuaTrigger: []
 --- !u!1 &4574901846507359337
 GameObject:
   m_ObjectHideFlags: 0

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

@@ -65,9 +65,11 @@ public class PlayerController : MoveCharacter
     [Header("蓝耗")]
     public float mp;
     public float totalMp;
+    public float totalMp_2Players;      //双人模式下总蓝量
     public bool isMpRepel = true;
     public bool isRapedReply;
-    public float mpReplySpeed = 1;
+    public float mpReplySpeed;
+    public float mpReplySpeed_2Players; //双人模式下蓝量回复速度
     public float rapidReplySpeed;
     public float lostMp;
     private float addMp = 10;
@@ -295,6 +297,21 @@ public class PlayerController : MoveCharacter
         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];