浏览代码

修复光球挡不了刺客问题

LAPTOP-OM1V99U2\永远de小亡灵 11 月之前
父节点
当前提交
fa4c138e11

+ 8 - 0
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Assassin.prefab

@@ -271,6 +271,8 @@ MonoBehaviour:
     repelValue: 10
   attackTriggers:
   - {fileID: 4347565098670608659}
+  addAttackEffect: {fileID: 0}
+  curDamage: 
   targetTypes: 010000000300000002000000
   targetCharacter: {fileID: 0}
   attackTarget: {fileID: 0}
@@ -321,6 +323,7 @@ MonoBehaviour:
   minRotateSpeed: 5
   isFloat: 0
   normalFallSpeed: 10
+  effect: {fileID: 0}
   playerMe: {fileID: 0}
   playerAni: {fileID: 0}
   playerCol: {fileID: 0}
@@ -359,6 +362,10 @@ MonoBehaviour:
   isBeBlownUp: 0
   isBeReboundedX: 0
   isBeReboundedY: 0
+  willBeComa: 0
+  willComaTime: 0
+  comaDamage: 0
+  willBeFly: 0
   type: 1
   searchState: 0
   attackDistance: 1.5
@@ -952,6 +959,7 @@ MonoBehaviour:
   targetY: 1
   aim: {fileID: 6373916053725309541}
   offset: 2
+  owner: {fileID: -677743004047987606}
 --- !u!1 &8203964573996106666
 GameObject:
   m_ObjectHideFlags: 0

+ 13 - 0
ActionTowerDefense/Assets/Scripts/Spirits/DashEffect.cs

@@ -14,6 +14,8 @@ public class DashEffect : MonoBehaviour
     public float targetY;           //刀光的高度
     public GameObject aim;
     public float offset;
+    public Character owner;
+    private bool isInVain;   //击中光球,攻击无效
 
     private void Awake()
     {
@@ -44,6 +46,13 @@ public class DashEffect : MonoBehaviour
 
     private void OnTriggerEnter(Collider other)
     {
+        Photosphere photosphere = other.GetComponentInParent<Photosphere>();
+        if (photosphere)
+        {
+            isInVain = true;
+            photosphere.Reflex(owner.beHitTrigger, attackInfo.damage);
+            return;
+        }
         //作为己方冲刺可检测enemy
         BeHitTrigger beHitTrigger = other.GetComponent<BeHitTrigger>();
         if(!isEnemy && beHitTrigger!=null&& other.transform.parent.parent.parent.gameObject.layer == 8 )
@@ -59,6 +68,10 @@ public class DashEffect : MonoBehaviour
         if (isEnemy && beHitTrigger != null && (other.transform.parent.parent.parent.gameObject.layer == 6
             || other.transform.parent.parent.parent.gameObject.layer == 7) )
         {
+            if(other.transform.parent.parent.parent.gameObject.layer == 6 && isInVain)
+            {
+                return;
+            }
             Character character = other.GetComponentInParent<Character>();
             if(!beHitTriggers.Exists(t => t == character))
             {