소스 검색

开局每个士兵预先加载50只

WGL 1 개월 전
부모
커밋
4ff7249f15

+ 9 - 7
ActionTowerDefense/Assets/Resources/Prefab/MySoldier/Demonic_Arrow.prefab

@@ -190,7 +190,7 @@ MonoBehaviour:
   haveVulnerable: 0
   vulnerableTime: 0
   stackingWoudsTime: 0
-  stackingWordsNum: 0
+  stackingWords: 0
   resistances:
     controlOrder: 0
     Float: 0
@@ -1390,6 +1390,12 @@ MonoBehaviour:
   platformRotZ: 0
   RotLerpSpeed: 0.6
   RotLerpTime: 0
+  needToAdjustFlyHeight: 1
+  flyHeight: 0
+  maxFlyHeight: 9
+  minFlyHeight: 5
+  flyUpTime: 0.241
+  isAdjustHeight: 0
   matState: 1
   spinee: {fileID: 0}
   mesh: {fileID: 0}
@@ -1399,12 +1405,6 @@ MonoBehaviour:
   outline1Mats:
   - {fileID: 2100000, guid: 916bb121eaeae3b43914636f946abdcd, type: 2}
   moveSpeed: 5
-  needToAdjustFlyHeight: 1
-  flyHeight: 0
-  maxFlyHeight: 9
-  minFlyHeight: 5
-  flyUpTime: 0.241
-  isAdjustHeight: 0
   isDamageReduction: 0
   reductionDegree: 0
   reductionEffect: {fileID: 0}
@@ -1426,6 +1426,7 @@ MonoBehaviour:
   frozenTime: 0
   searchState: 0
   myName: "\u98DE\u5251"
+  summonEndToDie: 0
   soldierType: 0
   player: {fileID: 0}
   playerID: 0
@@ -2053,3 +2054,4 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: fbe190f324f23354db9bd7d1ead1b60f, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  ac: {fileID: 6589564398742701796}

+ 9 - 7
ActionTowerDefense/Assets/Resources/Prefab/MySoldier/Demonic_Giant.prefab

@@ -418,7 +418,7 @@ MonoBehaviour:
   haveVulnerable: 0
   vulnerableTime: 0
   stackingWoudsTime: 0
-  stackingWordsNum: 0
+  stackingWords: 0
   resistances:
     controlOrder: 0
     Float: 0
@@ -763,6 +763,12 @@ MonoBehaviour:
   platformRotZ: 0
   RotLerpSpeed: 0.6
   RotLerpTime: 0
+  needToAdjustFlyHeight: 0
+  flyHeight: 0
+  maxFlyHeight: 0
+  minFlyHeight: 0
+  flyUpTime: 0
+  isAdjustHeight: 0
   matState: 1
   spinee: {fileID: 0}
   mesh: {fileID: 0}
@@ -772,12 +778,6 @@ MonoBehaviour:
   outline1Mats:
   - {fileID: 2100000, guid: 82f4327af6aa844459ee45d1f72de829, type: 2}
   moveSpeed: 2
-  needToAdjustFlyHeight: 0
-  flyHeight: 0
-  maxFlyHeight: 0
-  minFlyHeight: 0
-  flyUpTime: 0
-  isAdjustHeight: 0
   isDamageReduction: 0
   reductionDegree: 0
   reductionEffect: {fileID: 0}
@@ -799,6 +799,7 @@ MonoBehaviour:
   frozenTime: 0
   searchState: 0
   myName: "\u76FE\u7532\u5175"
+  summonEndToDie: 0
   soldierType: 1
   player: {fileID: 0}
   playerID: 0
@@ -1092,6 +1093,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: fbe190f324f23354db9bd7d1ead1b60f, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  ac: {fileID: 7709923136427189747}
 --- !u!1 &6139679835290116115
 GameObject:
   m_ObjectHideFlags: 0

+ 9 - 7
ActionTowerDefense/Assets/Resources/Prefab/MySoldier/Demonic_Sword.prefab

@@ -374,6 +374,12 @@ MonoBehaviour:
   platformRotZ: 0
   RotLerpSpeed: 0.6
   RotLerpTime: 0
+  needToAdjustFlyHeight: 0
+  flyHeight: 0
+  maxFlyHeight: 0
+  minFlyHeight: 0
+  flyUpTime: 0
+  isAdjustHeight: 0
   matState: 1
   spinee: {fileID: 0}
   mesh: {fileID: 0}
@@ -383,12 +389,6 @@ MonoBehaviour:
   outline1Mats:
   - {fileID: 2100000, guid: 79dada70fee9fbc49a327168481d3def, type: 2}
   moveSpeed: 3
-  needToAdjustFlyHeight: 0
-  flyHeight: 0
-  maxFlyHeight: 0
-  minFlyHeight: 0
-  flyUpTime: 0
-  isAdjustHeight: 0
   isDamageReduction: 0
   reductionDegree: 0
   reductionEffect: {fileID: 0}
@@ -410,6 +410,7 @@ MonoBehaviour:
   frozenTime: 0
   searchState: 0
   myName: "\u6797\u51B2"
+  summonEndToDie: 0
   soldierType: 2
   player: {fileID: 0}
   playerID: 0
@@ -882,6 +883,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: fbe190f324f23354db9bd7d1ead1b60f, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  ac: {fileID: 6797330787108410633}
 --- !u!1 &2437299196663985757
 GameObject:
   m_ObjectHideFlags: 0
@@ -1841,7 +1843,7 @@ MonoBehaviour:
   haveVulnerable: 0
   vulnerableTime: 0
   stackingWoudsTime: 0
-  stackingWordsNum: 0
+  stackingWords: 0
   resistances:
     controlOrder: 0
     Float: 0

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

@@ -364,9 +364,15 @@ public class PlayerController : MoveCharacter
         {
             demonicDic.Add(i, new List<Demonic>());
         }
+        for (int i = 0; i < 3; i++)
+        {
+            PoolManager.Preloading(demonicPrefabs[i],50);
+        }
+
         Init();
         spiritSystem = GameObject.Find("SpiritSystem").GetComponent<SpiritSystem>();
         fixedDeltaTime = Time.fixedDeltaTime;
+
     }
 
     private void Start()

+ 1 - 3
ActionTowerDefense/Assets/Scripts/Characters/SoldierBuff.cs

@@ -5,7 +5,7 @@ using UnityEngine;
 public class SoldierBuff : MonoBehaviour
 {
     private Demonic dem;
-    private AttackController ac;
+    public AttackController ac;
     private AttributeStatus ats;
 
     private int initTotalHp;
@@ -17,9 +17,7 @@ public class SoldierBuff : MonoBehaviour
     private void Awake()
     {
         dem = GetComponent<Demonic>();
-        ac = dem.attackController;
         ats = dem.attributeStatus;
-
         initTotalHp = dem.totalHp;
         initHp = dem.hp;
         for(int i = 0; i < ac.attackMethod_summon.Length; i++)

+ 13 - 0
ActionTowerDefense/Assets/Scripts/PoolManager.cs

@@ -48,6 +48,19 @@ public class PoolManager : MonoBehaviour
         return go;
     }
 
+    public static void Preloading(GameObject prefab,int num)
+    {
+        instance.activeObjs.Add(prefab, new List<GameObject>());
+        for (int i = 0; i < num; i++)
+        {
+            GameObject go = Object.Instantiate(prefab);
+            PoolItem poolItem = go.AddComponent<PoolItem>();
+            poolItem.prefab = prefab;
+            go.SetActive(false);
+            instance.activeObjs[prefab].Add(go);
+        }
+    }
+
     public static void InstantiateAsync(string name, Vector3 pos = default, Quaternion rotation = default, Transform parent = null, UnityAction<GameObject> callback = null)
     {
         if (instance == null)