Переглянути джерело

变身隐身周围魂存在上限,灵魂不稳定状态最多掉一个魂

LAPTOP-OM1V99U2\永远de小亡灵 1 рік тому
батько
коміт
fc428a55fd

+ 1 - 0
ActionTowerDefense/Assets/Resources/Prefab/Transfiguration/Trans_Invisible.prefab

@@ -1046,6 +1046,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: ab384f1e67f469d43b1563b91227035d, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  maxSoulNumber: 10
   soulNumbers: 0
   soulFollowEffect: {fileID: 4610496197409361392}
 --- !u!1 &8769150919382874379

+ 2 - 0
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -350,6 +350,8 @@ public class MoveCharacter : Character
             }
             if (isSoulUnstable)
             {
+                isSoulUnstable = false;
+                ChangeMat(1);
                 GameObject soulObj = PoolManager.Instantiate(soulPrefab, transform.position);
                 Vector3 dir = Vector3.up;
                 soulObj.GetComponent<Soul>().Burst(dir * soulStartSpeed);

+ 6 - 0
ActionTowerDefense/Assets/Scripts/Spirits/InvisibleSoulCollector.cs

@@ -5,10 +5,16 @@ using System.Threading.Tasks;
 
 public class InvisibleSoulCollector : MonoBehaviour
 {
+    public int maxSoulNumber;
     public int soulNumbers;
     public SoulFollowEffect soulFollowEffect;
+    
     private void OnTriggerEnter(Collider other)
     {
+        if (soulNumbers >= maxSoulNumber)
+        {
+            return;
+        }
         Soul soul = other.GetComponentInParent<Soul>();
         if (soul)
         {