Ver código fonte

debug对主角造成的伤害开关+山的伤害漏传

LAPTOP-OM1V99U2\永远de小亡灵 10 meses atrás
pai
commit
460cfd659a

+ 4 - 0
ActionTowerDefense/Assets/Scripts/AttackTrigger.cs

@@ -69,6 +69,10 @@ public class AttackTrigger : MonoBehaviour
                 if (trigedObjs[i] && Util.CheckCanHit(owner.tag, trigedObjs[i].owner.tag) && !trigedObjs[i].owner.isDie)
                 {
                     trigedObjs[i].BeHit(damage, force, changeHurt, repelValue);
+                    if (trigedObjs[i].owner.debugAttackFrom)
+                    {
+                        trigedObjs[i].owner.DebugAttackFrom(owner.name,damage);
+                    }
                     if (owner.GetComponent<Demonic>())
                     {
                         trigedObjs[i].attackerID = owner.GetComponent<Demonic>().id;

+ 4 - 0
ActionTowerDefense/Assets/Scripts/Boss/YuMenGuan/LaserHit.cs

@@ -41,6 +41,10 @@ public class LaserHit : MonoBehaviour
             foreach (Character c in continueHit)
             {
                 c.BeHit(damage, Vector3.zero, false, 0);
+                if (c.debugAttackFrom)
+                {
+                    c.DebugAttackFrom("Boss_YuMenGuan", damage);
+                }
             }
             damage += acc;
         }

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

@@ -66,6 +66,10 @@ public class Bullet : MonoBehaviour
             if (Vector3.Distance(dis1,dis2) < 0.1)
             {
                 trackTarget.BeHit(damage, Vector3.zero, false, 0);
+                if (trackTarget.debugAttackFrom)
+                {
+                    trackTarget.DebugAttackFrom(owner.name, damage);
+                }
                 gameObject.SetActive(false);
             }
         }
@@ -187,11 +191,19 @@ public class Bullet : MonoBehaviour
                     {
                         case BulletType.Single:
                             hitTrigger.BeHit(damage, force * (-transform.right), changeHurt, repelValue);
+                            if (hitTrigger.owner.debugAttackFrom)
+                            {
+                                hitTrigger.owner.DebugAttackFrom(owner.name, damage);
+                            }
                             isGetTarget = true;
                             gameObject.SetActive(false);
                             break;
                         case BulletType.Penetrate:
                             hitTrigger.BeHit(damage, force * (-transform.right), changeHurt, repelValue);
+                            if (hitTrigger.owner.debugAttackFrom)
+                            {
+                                hitTrigger.owner.DebugAttackFrom(owner.name, damage);
+                            }
                             break;
                         case BulletType.Bomb:
                             break;

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

@@ -145,6 +145,9 @@ public class Character : MonoBehaviour
 
     [Header("传送门")]
     public bool attack1ShootCanTransmit;    //普攻1弓箭可以被传送
+
+    //调试开关
+    [Header("debug攻击者")] public bool debugAttackFrom;
     public virtual void Init()
     {
         //确保组件不丢失
@@ -224,6 +227,11 @@ public class Character : MonoBehaviour
     public virtual void ChangeState(CharacterState newState)
     {
     }
+    public void DebugAttackFrom(string attackFrom, int damage)
+    {
+        Debug.Log(attackFrom + "对" + gameObject.name + "造成了" + damage.ToString() + "点伤害");
+    }
+
 
     public virtual void BeHit(int damage, Vector3 force, bool changeHurt, float repelValue)
     {

+ 3 - 2
ActionTowerDefense/Assets/Scripts/Conduct/Mountain.cs

@@ -8,7 +8,8 @@ public class Mountain : MonoBehaviour
     public PlayerController pc;
     public int id;
     public Foot foot;
-    public int demonicNum; 
+    public int demonicNum;
+    public int damage;
 
     private void Update()
     {
@@ -27,7 +28,7 @@ public class Mountain : MonoBehaviour
             Enemy en = other.GetComponentInParent<Enemy>();
             en.willComaTime = comaTime;
             en.willBeComa = true;
-            en.comaDamage = demonicNum * 100;
+            en.comaDamage = demonicNum * damage;
             en.ChangeState(CharacterState.Fall);
         }
     }

+ 4 - 1
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -31,7 +31,6 @@ public class MoveCharacter : Character
     public float totalBeRepelValue;
     [HideInInspector]
     public float beRepelValue;
-    [HideInInspector]
     public float weakTime;
     public float totalWeakTime;
     public float weakHitRate = 2;
@@ -413,6 +412,10 @@ public class MoveCharacter : Character
             if (gameObject.CompareTag("Player"))
             {
                 text.color = Color.red;
+                if (debugAttackFrom)
+                {
+                    Debug.Log("Ö÷½ÇÊܵ½" + damage.ToString() + "µãÉ˺¦");
+                }
             }
         }
 

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

@@ -103,6 +103,10 @@ public class DashEffect : MonoBehaviour
         {
             character.BeHit(attackInfo.damage, attackInfo.force * attackInfo.attackDir,
                 attackInfo.changeHurt, attackInfo.repelValue);
+            if (character.debugAttackFrom)
+            {
+                character.DebugAttackFrom(owner.name, attackInfo.damage);
+            }
         }
         catch
         {

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

@@ -50,6 +50,10 @@ public class SoulBoom : MonoBehaviour
                         target = (pos1 - pos2).normalized;
                         characters[i].BeHit
                             (attackInfo.damage, target * attackInfo.force, true, attackInfo.repelValue);
+                        if (characters[i].debugAttackFrom)
+                        {
+                            characters[i].DebugAttackFrom(owner.name, attackInfo.damage);
+                        }
                     }
                     isBoom = true;
                     GetComponent<Collider>().enabled = false;