Browse Source

龙卷扇结束后击飞;游龙球删除累伤

WGL 1 month ago
parent
commit
f3fd7bf017

+ 7 - 4
ActionTowerDefense/Assets/Resources/Prefab/Conduct/TornadoFan.prefab

@@ -78,7 +78,7 @@ MonoBehaviour:
       criticalChance: 0
       lifesteal: 0
       effect: {fileID: 0}
-      attackEffect: 
+      attackEffect: 06000000
       attackMethod_Type: 0
       floatState:
         time: 0
@@ -114,8 +114,8 @@ MonoBehaviour:
         rate: 0
         time: 0
       stackingWounds:
-        damage: 0
-        time: 0
+        damage: 1
+        time: 0.5
       changeDamage:
         rate: 0
       sustainedInjury:
@@ -146,8 +146,11 @@ MonoBehaviour:
   rotationRangeX: {x: 1, y: 2}
   rotationRangeY: {x: -2, y: 2}
   distance: 0.5
+  landingDamageRate: 2.5
+  forceRate: 1
+  forceMax: 110
+  weakTime: 2
   lerpValue: 10
-  totalAttackNum: 0
   damage: 0
   totalTime: 0
   time: 0

+ 1 - 1
ActionTowerDefense/Assets/Scripts/Characters/AttackController.cs

@@ -34,7 +34,7 @@ public class AttackInfo
     [LabelText("暴击率")] public int criticalChance;
     [LabelText("吸血")] public int lifesteal;
     [LabelText("击中特效")] public GameObject effect;
-    public AttackEffect[] attackEffect;
+    public List<AttackEffect> attackEffect;
     [HideInInspector] public AttackMethod_Type attackMethod_Type;
 
     //漂浮

+ 2 - 4
ActionTowerDefense/Assets/Scripts/Characters/AttributeStatus.cs

@@ -45,7 +45,7 @@ public class AttributeStatus : MonoBehaviour
     [TabGroup("击飞击落")] [DisplayOnly] public bool isFly;
     [TabGroup("击飞击落")] [LabelText("X方向阻力")] public float decelerationRatioX = 2f;
     [TabGroup("击飞击落")] [LabelText("Y方向重力")] public float decelerationRatioY = 15f;
-    private Character landingDamageFrom;
+    public Character landingDamageFrom;
     private Vector3 startFlyPos;
 
     [TabGroup("击飞击落")] [LabelText("旋转中心高度")] public float rotateCenterHeight = 1f;
@@ -130,7 +130,7 @@ public class AttributeStatus : MonoBehaviour
 
     public void AddSpecialState(AttackController.AttackMethod attackMethod, Character attackFrom)
     {
-        if (attackMethod.attackInfo.attackEffect != null && attackMethod.attackInfo.attackEffect.Length > 0)
+        if (attackMethod.attackInfo.attackEffect.Count > 0)
         {
             AttackEffect attackEffect = AttackEffect.Null;
             foreach (AttackEffect ae in attackMethod.attackInfo.attackEffect)
@@ -203,7 +203,6 @@ public class AttributeStatus : MonoBehaviour
                     //击飞
                     case AttackEffect.BlowUp:
                         AddBlowUp(attackMethod, attackFrom.bodyTrans);
-                        character.bodyCollider.layer = LayerMask.NameToLayer("BodyToPlatformCollider");
                         if (attackMethod.attackInfo.blowUp.haveLandingDamage)
                         {
                             landingDamageFrom = attackFrom;
@@ -212,7 +211,6 @@ public class AttributeStatus : MonoBehaviour
                     //击落
                     case AttackEffect.ShotDown:
                         AddShotDown(attackMethod, attackFrom.bodyTrans);
-                        character.bodyCollider.layer = LayerMask.NameToLayer("BodyToPlatformCollider");
                         if (attackMethod.attackInfo.shotDown.haveLandingDamage)
                         {
                             landingDamageFrom = attackFrom;

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

@@ -316,7 +316,7 @@ public class MoveCharacter : Character
         }
         int armorRate = attributeStatus.resistances.armor;
         bool haveStackingWords = false;
-        if (attackInfo.attackEffect != null && attackInfo.attackEffect.Length > 0)
+        if (attackInfo.attackEffect != null && attackInfo.attackEffect.Count > 0)
         {
             foreach (AttackEffect ae in attackInfo.attackEffect)
             {

+ 4 - 4
ActionTowerDefense/Assets/Scripts/Characters/SoldierBuff.cs

@@ -68,7 +68,7 @@ public class SoldierBuff : MonoBehaviour
         for (int i = 0; i < ac.attackMethod_summon.Length; i++)
         {
             AttackInfo ai = ac.attackMethod_summon[i].attackInfo;
-            AttackEffect[] aes = ai.attackEffect;
+            List<AttackEffect> aes = ai.attackEffect;
             foreach (AttackEffect ae in aes)
             {
                 if (ae == AttackEffect.ShotDown)
@@ -84,7 +84,7 @@ public class SoldierBuff : MonoBehaviour
         for (int i = 0; i < ac.attackMethod_march.Length; i++)
         {
             AttackInfo ai = ac.attackMethod_march[i].attackInfo;
-            AttackEffect[] aes = ai.attackEffect;
+            List<AttackEffect> aes = ai.attackEffect;
             foreach (AttackEffect ae in aes)
             {
                 if (ae == AttackEffect.ShotDown)
@@ -104,7 +104,7 @@ public class SoldierBuff : MonoBehaviour
         for (int i = 0; i < ac.attackMethod_summon.Length; i++)
         {
             AttackInfo ai = ac.attackMethod_summon[i].attackInfo;
-            AttackEffect[] aes = ai.attackEffect;
+            List<AttackEffect> aes = ai.attackEffect;
             foreach (AttackEffect ae in aes)
             {
                 if (ae == AttackEffect.BlowUp)
@@ -120,7 +120,7 @@ public class SoldierBuff : MonoBehaviour
         for (int i = 0; i < ac.attackMethod_march.Length; i++)
         {
             AttackInfo ai = ac.attackMethod_march[i].attackInfo;
-            AttackEffect[] aes = ai.attackEffect;
+            List<AttackEffect> aes = ai.attackEffect;
             foreach (AttackEffect ae in aes)
             {
                 if (ae == AttackEffect.BlowUp)

+ 2 - 1
ActionTowerDefense/Assets/Scripts/Conduct/DragonController.cs

@@ -113,7 +113,8 @@ public class DragonController : MonoBehaviour
         demonic.ignoresOnState = true;
         AttackTrigger dragonTrigger = demonic.dragonTrigger;
         dragonTrigger.gameObject.SetActive(true);
-        dragonTrigger.attackMethod = demonic.attackController.attackMethod_summon[0];
+        //dragonTrigger.attackMethod = demonic.attackController.attackMethod_summon[0];
+        dragonTrigger.attackMethod.attackInfo.damage = demonic.attackController.attackMethod_summon[0].attackInfo.damage;
         demonic.beHitTrigger.gameObject.SetActive(false);
         demonic.beSearchTrigger.gameObject.SetActive(false);
         demonic.ani.Play(AnimatorHash.ANIMATOR_walk, 0, 0);

+ 30 - 6
ActionTowerDefense/Assets/Scripts/Conduct/TornadoFan.cs

@@ -10,6 +10,10 @@ public class TornadoFan : AttackTrigger
     [LabelText("相对于轴心旋转范围")] public Vector2 rotationRangeX;
     [LabelText("Y轴差值范围")] public Vector2 rotationRangeY;
     [LabelText("重新判定距离")] public float distance;
+    [LabelText("落地伤害倍率")] public float landingDamageRate;
+    [LabelText("结束击飞力的斜率")] public float forceRate;
+    [LabelText("结束击飞力最大值")] public float forceMax;
+    [LabelText("落地后眩晕时间")] public float weakTime;
     public float lerpValue;
     [DisplayOnly] public int damage;
     [DisplayOnly] public float totalTime;
@@ -28,10 +32,29 @@ public class TornadoFan : AttackTrigger
                 MoveCharacter moveCharacter = beHitTrigger.owner as MoveCharacter;
                 if (moveCharacter != null)
                 {
-                    moveCharacter.ChangeState(CharacterState.Idle);
-                    bool canfly = moveCharacter.canFly;
-                    moveCharacter.rb.useGravity = !canfly;
-                    moveCharacter.nowCanFly = canfly;
+                    AttackController.AttackMethod attackMethod = new AttackController.AttackMethod();
+                    attackMethod.attackInfo = new AttackInfo();
+                    attackMethod.attackInfo.attackEffect = new List<AttackEffect>();
+                    attackMethod.attackInfo.attackEffect.Add(AttackEffect.BlowUp);
+                    AttackInfo.BlowUp blowUp = attackMethod.attackInfo.blowUp;
+                    float dir = moveCharacter.transform.position.x - transform.position.x;
+                    if (dir >= 0)
+                    {
+                        blowUp.dir = new Vector3(1, 0.5f, 0);
+                        blowUp.force = -forceRate * dir + forceMax;
+                    }
+                    else
+                    {
+                        blowUp.dir = new Vector3(-1, 0.5f, 0);
+                        blowUp.force = forceRate * dir + forceMax;
+                    }
+                    blowUp.time = weakTime;
+                    blowUp.haveLandingDamage = true;
+                    blowUp.landingDamageRate = landingDamageRate;
+                    attackMethod.attackInfo.blowUp = blowUp;
+                    moveCharacter.attributeStatus.AddBlowUp(attackMethod, owner.bodyTrans);
+                    moveCharacter.bodyCollider.layer = LayerMask.NameToLayer("BodyToPlatformCollider");
+                    moveCharacter.attributeStatus.landingDamageFrom = owner;
                 }
             }
             gameObject.SetActive(false);
@@ -43,7 +66,7 @@ public class TornadoFan : AttackTrigger
         {
             for (int i = 0; i < trigedLen - targetLen; i++)
             {
-                targetPoss.Add(CalculateTargetPos(trigedObjs[trigedLen - i - 1].owner.transform.position));
+                targetPoss.Add(CalculateTargetPos(trigedObjs[targetLen + i].owner.transform.position));
             }
         }
         else if (targetLen > trigedLen)
@@ -63,6 +86,7 @@ public class TornadoFan : AttackTrigger
                 if (moveCharacter.state != CharacterState.Another && moveCharacter.state != CharacterState.Die)
                 {
                     moveCharacter.ChangeState(CharacterState.Another);
+                    moveCharacter.ani.Play(AnimatorHash.ANIMATOR_weak, 0, 0);
                     if (moveCharacter.nowCanFly == false)
                     {
                         moveCharacter.rb.useGravity = false;
@@ -106,7 +130,7 @@ public class TornadoFan : AttackTrigger
         float dir = originalPos.x < transform.position.x ? 1 : -1;
         Vector3 targetPos = transform.position;
         targetPos.x += dir * Random.Range(rotationRangeX.x,rotationRangeX.y);
-        Vector2 rangeY = new Vector2(targetPos.y + rotationRangeY.x, targetPos.y + rotationRangeY.y);
+        Vector2 rangeY = new Vector2(originalPos.y + rotationRangeY.x, originalPos.y + rotationRangeY.y);
         if(rangeY.x < 0)
         {
             rangeY.x = 0;