Преглед на файлове

时间变慢的时候镜头停止移动

LAPTOP-OM1V99U2\永远de小亡灵 преди 10 месеца
родител
ревизия
4043c928e3
променени са 2 файла, в които са добавени 19 реда и са изтрити 10 реда
  1. 5 1
      ActionTowerDefense/Assets/Scripts/CameraController.cs
  2. 14 9
      ActionTowerDefense/Assets/Scripts/Character.cs

+ 5 - 1
ActionTowerDefense/Assets/Scripts/CameraController.cs

@@ -231,8 +231,12 @@ public class CameraController : MonoBehaviour
             {
                 targetPos = CameraTargetMove(player0);
             }
-            mainCamera.transform.position =
+            if(Time.timeScale == 1)
+            {
+                mainCamera.transform.position =
                 Vector3.Lerp(mainCamera.transform.position, targetPos, lerpValue * Time.deltaTime);
+            }
+            
         }
         //else if (player1 == player0)
         //{

+ 14 - 9
ActionTowerDefense/Assets/Scripts/Character.cs

@@ -269,6 +269,7 @@ public class Character : MonoBehaviour
         else
         {
             attackInfo = attack2Infos[shootId];
+            attackInfo.damage = curDamage2[0];
         }
         GameObject bulletObj = PoolManager.Instantiate(bulletPrefab);
         Bullet bullet = bulletObj.GetComponent<Bullet>();
@@ -345,19 +346,23 @@ public class Character : MonoBehaviour
         ani.Play("attack_march", 0, 0);
         aniCollider.Play("Attack2", 1, 0);
         attackTime = totalAttack2Time;
-        for (int i = 0; i < attack2Infos.Count; i++)
+        if(attackTriggers.Count > 0)
         {
-            attackTriggers[i].damage = curDamage2[i];
-            attackTriggers[i].changeHurt = attack2Infos[i].changeHurt;
-            attackTriggers[i].repelValue = attack2Infos[i].repelValue;
-            Vector3 attackDir = attack2Infos[i].attackDir.normalized;
-            if (bodyTrans.localScale.x < 0)
+            for (int i = 0; i < attack2Infos.Count; i++)
             {
-                attackDir.x = -attackDir.x;
-            }
-            attackTriggers[i].force = attackDir * attack2Infos[i].force;
+                attackTriggers[i].damage = curDamage2[i];
+                attackTriggers[i].changeHurt = attack2Infos[i].changeHurt;
+                attackTriggers[i].repelValue = attack2Infos[i].repelValue;
+                Vector3 attackDir = attack2Infos[i].attackDir.normalized;
+                if (bodyTrans.localScale.x < 0)
+                {
+                    attackDir.x = -attackDir.x;
+                }
+                attackTriggers[i].force = attackDir * attack2Infos[i].force;
+            }   
         }
 
+
         ChangeState(CharacterState.Attack);
     }