ソースを参照

敌方被炸到新增“灵魂不稳定状态”

LAPTOP-OM1V99U2\永远de小亡灵 1 年間 前
コミット
14d2c83fa5

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

@@ -108,6 +108,8 @@ public class Character : MonoBehaviour
     public bool beLarger = false;
 
     public bool attackToFloat = false;      //攻击使敌方漂浮
+    public bool isSoulUnstable;             //灵魂不稳定状态
+    public float soulUnstableTime;          //灵魂不稳定状态时间
 
     public virtual void Init()
     {

+ 3 - 2
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -40,8 +40,8 @@ public class Enemy : MoveCharacter
     public float maxMoveSpeed, minMoveSpeed;
     public float runSpeed;
     public int dropSoul = 1;
-    public GameObject soulPrefab;
-    public float soulStartSpeed = 5f;
+
+    
     public float dropSoulAngle = 60f;
 
     [HideInInspector]
@@ -71,6 +71,7 @@ public class Enemy : MoveCharacter
     public float finishRushTime;
     public bool isBack = false; //Íù·´·½Ïò×ß
 
+
     private void Awake()
     {
         aimDistance = rushTime * rushSpeed / 2;

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

@@ -81,6 +81,8 @@ public class MoveCharacter : Character
     public Material[] playerOut;
     public bool isInvisible;
     public bool canNotChangeHurt;
+    public GameObject soulPrefab;
+    public float soulStartSpeed = 1f;
 
     private void Awake()
     {
@@ -272,8 +274,10 @@ public class MoveCharacter : Character
 
     public override void BeHit(int damage, Vector3 force, bool changeHurt, float repelValue)
     {
+
         if (!isTran)
         {
+
             if (isInvisible)
             {
                 return;
@@ -292,6 +296,12 @@ public class MoveCharacter : Character
                 rb.AddForce(force);
                 return;
             }
+            if (isSoulUnstable)
+            {
+                GameObject soulObj = PoolManager.Instantiate(soulPrefab, transform.position);
+                Vector3 dir = Vector3.up;
+                soulObj.GetComponent<Soul>().Burst(dir * soulStartSpeed);
+            }
             if (canNotChangeHurt)
             {
                 return;
@@ -308,6 +318,7 @@ public class MoveCharacter : Character
             {
                 ChangeState(CharacterState.Weak);
             }
+
         }
         else
         {
@@ -318,4 +329,5 @@ public class MoveCharacter : Character
             pc.BeHit(damage, force, changeHurt, repelValue);
         }
     }
+
 }

+ 3 - 0
ActionTowerDefense/Assets/Scripts/Spirits/SoulBoom.cs

@@ -13,6 +13,7 @@ public class SoulBoom : MonoBehaviour
     public float destroyTime;
     public List<Character> characters = new List<Character>();
     public bool isTransfiguration;
+    public float soulUnstableTime;
     private void Update()
     {
         time += Time.deltaTime;
@@ -45,6 +46,8 @@ public class SoulBoom : MonoBehaviour
                             target = new Vector3(-attackInfo.attackDir.x, attackInfo.attackDir.y,
                                 attackInfo.attackDir.z);
                         }
+                        characters[i].isSoulUnstable = true;
+                        characters[i].soulUnstableTime = soulUnstableTime;
                         characters[i].BeHit
                             (attackInfo.damage, target * attackInfo.force,
                             attackInfo.changeHurt, attackInfo.repelValue);