瀏覽代碼

刺客scale bug

LAPTOP-OM1V99U2\永远de小亡灵 1 年之前
父節點
當前提交
a953e59c6f

+ 5 - 5
ActionTowerDefense/Assets/Resources/Prefab/FX/FollowSoulEffect.prefab

@@ -88184,10 +88184,10 @@ MonoBehaviour:
   isBoom: 0
   attackInfo:
     damage: 400
-    attackDir: {x: 0, y: 0, z: 0}
-    force: 0
-    changeHurt: 0
-    repelValue: 0
+    attackDir: {x: 2, y: 2, z: 0}
+    force: 100
+    changeHurt: 1
+    repelValue: 100
   destroyTime: 5
   characters: []
 --- !u!54 &923046814478230668
@@ -88215,7 +88215,7 @@ SphereCollider:
   m_GameObject: {fileID: 7974523266980730195}
   m_Material: {fileID: 0}
   m_IsTrigger: 1
-  m_Enabled: 1
+  m_Enabled: 0
   serializedVersion: 2
   m_Radius: 8
   m_Center: {x: 0, y: 0.46, z: 0}

+ 23 - 4
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -976,12 +976,21 @@ public class Enemy : MoveCharacter
         if (targetDir.x < 0)
         {
             aimEffect.transform.rotation = Quaternion.Euler(new Vector3(0, 0, k));
-            bodyTrans.localScale = new Vector3(1, 1, 1);
+            if (bodyTrans.localScale.x < 0)
+            {
+                bodyTrans.localScale =
+                    new Vector3(-bodyTrans.localScale.x, bodyTrans.localScale.y, bodyTrans.localScale.z);
+            }
+
         }
         else
         {
             aimEffect.transform.rotation = Quaternion.Euler(new Vector3(0, 0, k));
-            bodyTrans.localScale = new Vector3(-1, 1, 1);
+            if (bodyTrans.localScale.x > 0)
+            {
+                bodyTrans.localScale =
+                    new Vector3(-bodyTrans.localScale.x, bodyTrans.localScale.y, bodyTrans.localScale.z);
+            }
         }
     }
 
@@ -991,13 +1000,23 @@ public class Enemy : MoveCharacter
         if (targetDir.x < 0)
         {
             dashEffect.offset = 1;
-            bodyTrans.localScale = new Vector3(1, 1, 1);
+            if (bodyTrans.localScale.x < 0)
+            {
+                bodyTrans.localScale =
+                    new Vector3(-bodyTrans.localScale.x, bodyTrans.localScale.y, bodyTrans.localScale.z);
+            }
+
             bodyTrans.rotation = Quaternion.Euler(new Vector3(0, 0, k - 180));
         }
         else
         {
+            if (bodyTrans.localScale.x > 0)
+            {
+                bodyTrans.localScale =
+                    new Vector3(-bodyTrans.localScale.x, bodyTrans.localScale.y, bodyTrans.localScale.z);
+            }
+
             dashEffect.offset = -1;
-            bodyTrans.localScale = new Vector3(-1, 1, 1);
             bodyTrans.rotation = Quaternion.Euler(new Vector3(0, 0, k));
         }
 

+ 3 - 5
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -185,7 +185,6 @@ public class MoveCharacter : Character
 
     public override void BeHit(int damage, Vector3 force, bool changeHurt, float repelValue)
     {
-        print("MoveCharacterBeHit");
         if (invincibleTime > 0)
         {
             return;
@@ -194,22 +193,21 @@ public class MoveCharacter : Character
         uiHp.Show(hp, totalHp);
         if (hp <= 0)
         {
-            rb.AddForce(force);
+            
             ChangeState(CharacterState.Die);
+            rb.AddForce(force);
             return;
         }
         else if (changeHurt && state == CharacterState.Weak)
         {
-            print("ChangeHurt");
-            rb.AddForce(force);
             ChangeState(CharacterState.Hurt);
+            rb.AddForce(force);
             beRepelValue = totalBeRepelValue;
             return;
         }
         beRepelValue -= repelValue;
         if (changeHurt && beRepelValue <= 0)
         {
-            print("ChangeWeak");
             ChangeState(CharacterState.Weak);
         }
     }

+ 18 - 1
ActionTowerDefense/Assets/Scripts/Spirits/SoulBoom.cs

@@ -19,20 +19,37 @@ public class SoulBoom : MonoBehaviour
         {
             if (!isBoom)
             {
+                
                 for(int i = 0; i < characters.Count; i++)
                 {
                     if (characters[i].state == CharacterState.Die)
                     {
                         continue;
                     }
+
+                    Vector3 target;
+                    if (characters[i].transform.position.x > transform.position.x)
+                    {
+                        target = attackInfo.attackDir;
+                    }
+                    else
+                    {
+                        target = new Vector3(-attackInfo.attackDir.x, attackInfo.attackDir.y,
+                            attackInfo.attackDir.z);
+                    }
                     characters[i].BeHit
-                        (attackInfo.damage, Vector3.zero, attackInfo.changeHurt, attackInfo.repelValue);
+                        (attackInfo.damage, target * attackInfo.force,
+                        attackInfo.changeHurt, attackInfo.repelValue);
                     isBoom = true;
                 }
 
             }
             
         }
+        else if(time >= boomTime - 0.01f)
+        {
+            GetComponent<Collider>().enabled = true;
+        }
         if (time >= destroyTime)
         {
             gameObject.SetActive(false);