Parcourir la source

主角刷新位置根据塔的位置来

WGL il y a 2 mois
Parent
commit
eb60728451

+ 1 - 1
ActionTowerDefense/Assets/Resources/Prefab/Player.prefab

@@ -5754,7 +5754,7 @@ MonoBehaviour:
   heavyDamage: 100
   killer: {fileID: 0}
   playerId: 0
-  pos: {x: 140, y: 0}
+  refreshPos: {x: 5, y: 1}
   canJump: 1
   aniCollider: {fileID: 5072770566235913242}
   uiMp: {fileID: 8465211090008398057}

+ 5 - 3
ActionTowerDefense/Assets/Scripts/Characters/PlayerController.cs

@@ -18,7 +18,7 @@ public class PlayerController : MoveCharacter
     [Space(30)]
     [Title("PlayerControllerÊôÐÔ")]
     public int playerId;
-    public Vector2 pos;
+    [LabelText("Ö÷½ÇË¢ÐÂλÖÃ")] public Vector2 refreshPos;
     public bool canJump;
     public Animator aniCollider;
 
@@ -343,7 +343,8 @@ public class PlayerController : MoveCharacter
         spirits = GetComponent<Spirits>();
         conductController = GetComponent<ConductController>();
         playerId = playerInput.playerIndex;
-        transform.position = new Vector3(pos.x, pos.y, 0);
+        Vector3 towerPos = TowerMap.myTowers[0].transform.position;
+        transform.position = new Vector3(towerPos.x + refreshPos.x, towerPos.y + refreshPos.y, 0);
         switch (playerId)
         {
             case 0:
@@ -1457,7 +1458,8 @@ public class PlayerController : MoveCharacter
         bodyTrans.gameObject.SetActive(true);
         uiHp.transform.parent.gameObject.SetActive(true);
         rb.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation;
-        transform.position = new Vector3(142 + 4 * playerId, 0, 0);
+        Vector3 towerPos = TowerMap.myTowers[0].transform.position;
+        transform.position = new Vector3(towerPos.x + refreshPos.x , towerPos.y+refreshPos.y, 0);
         switch (playerId)
         {
             case 0: