WGL vor 1 Monat
Ursprung
Commit
991178a8f1

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

@@ -316,6 +316,7 @@ public class PlayerController : MoveCharacter
     public override void Awake()
     {
         gameManager = GameManager.instance;
+        gameManager.player = this;
         base.Awake();
         PlayerInput playerInput = transform.GetComponent<PlayerInput>();
         ss = Camera.main.GetComponentInParent<ScreenShake>();

+ 2 - 1
ActionTowerDefense/Assets/Scripts/GameManager.cs

@@ -59,6 +59,7 @@ public class GameManager : MonoBehaviour
     [FoldoutGroup("组件")] public GameObject shopButton;
     [FoldoutGroup("组件")] public ShopUI shopUI;
     [FoldoutGroup("组件")] public TextMeshProUGUI moneyText;
+    [FoldoutGroup("组件")] public PlayerController player;
 
     [FoldoutGroup("金币结算", order: -1)][LabelText("限制时间")] public int rewardTime;
     [FoldoutGroup("金币结算")][LabelText("金币奖励")] public int totalMoney;
@@ -340,6 +341,7 @@ public class GameManager : MonoBehaviour
         }
         for(int i = 0; i < 3; i++)
         {
+            player.demonicDic[i] = new List<Demonic>();
             demonicNum[i].GetComponentInChildren<TextMeshProUGUI>().text = "0";
         }
         EnemyCreater.instance.Init();
@@ -359,7 +361,6 @@ public class GameManager : MonoBehaviour
 
     public void GetTreasure(Treasure treasure)
     {
-        PlayerController player = PlayersInput.instance[0];
         for (int i = 0; i < treasure.type.Count; i++)
         {
             float data = treasure.data[i];