Просмотр исходного кода

修复融魂技慢动作卡顿掉帧问题

wgl 7 месяцев назад
Родитель
Сommit
326a216552
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      ActionTowerDefense/Assets/Scripts/Characters/PlayerController.cs

+ 4 - 0
ActionTowerDefense/Assets/Scripts/Characters/PlayerController.cs

@@ -170,6 +170,7 @@ public class PlayerController : MoveCharacter
     public ConductReadyTip conductReadyTip; //指挥技就绪
     private bool isReadyConduct;
     [Header("时间倍率")] [Tooltip("时间速度放慢到正常的几倍")] public float timeSlowingMultiplier;
+    [DisplayOnly]public float fixedDeltaTime;
     public float readyTipFxTime;
     [Header("转换率")] public float[] conversionRate;
     //大胖子
@@ -460,6 +461,7 @@ public class PlayerController : MoveCharacter
         }
         Init();
         spiritSystem = GameObject.Find("SpiritSystem").GetComponent<SpiritSystem>();
+        fixedDeltaTime = Time.fixedDeltaTime;
     }
 
     private void Update()
@@ -773,6 +775,7 @@ public class PlayerController : MoveCharacter
                 if (Time.timeScale == 1)
                 {
                     Time.timeScale = timeSlowingMultiplier;
+                    Time.fixedDeltaTime = fixedDeltaTime * Time.timeScale;
                     int boostNum = demonicDic[nowConductButton].Count;
                     int dienum = Mathf.RoundToInt(boostNum * conversionRate[nowConductButton]);
                     if (boostNum == 1)
@@ -1852,6 +1855,7 @@ public class PlayerController : MoveCharacter
             case CharacterState.Conduct:
                 rb.isKinematic = false;
                 Time.timeScale = 1;
+                Time.fixedDeltaTime = fixedDeltaTime * Time.timeScale;
                 Debug.Log(222);
                 conductReadyTip.activeFalse();
                 break;