瀏覽代碼

变身法师后在空中飞行时移速减慢

SZAND\msx_2 1 年之前
父節點
當前提交
3baba21ede

+ 4 - 1
ActionTowerDefense/Assets/Resources/Prefab/MySpirit/Spirits_Float.prefab

@@ -973,6 +973,8 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   maxHeight: 8
   minHeight: 6
+  floatProbability: 5
+  abilityTimes: -1
 --- !u!114 &8639832132491289351
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -998,7 +1000,6 @@ MonoBehaviour:
   rb: {fileID: 8639832132491289349}
   bodyTrans: {fileID: 5769591908339262981}
   beSearchTrigger: {fileID: 316813748882225178}
-  attackTrigger: {fileID: 0}
   uiHp: {fileID: 3586716274361854270}
   state: 0
   attackTime: 0
@@ -1057,6 +1058,8 @@ MonoBehaviour:
   canHitFloat: 0
   floatProbability: 0
   attackToFloat: 0
+  floatTimes: 0
+  hasFloatTimes: 0
   isSoulUnstable: 0
   soulUnstableTime: 0
   criticalChance: 0

+ 8 - 1
ActionTowerDefense/Assets/Resources/Prefab/Player.prefab

@@ -774,7 +774,6 @@ MonoBehaviour:
   rb: {fileID: 3571941038519084339}
   bodyTrans: {fileID: 2788556811231999033}
   beSearchTrigger: {fileID: 573198802}
-  attackTrigger: {fileID: 0}
   uiHp: {fileID: 205997967}
   state: 1
   attackTime: 0
@@ -835,6 +834,8 @@ MonoBehaviour:
   canHitFloat: 0
   floatProbability: 0
   attackToFloat: 0
+  floatTimes: 0
+  hasFloatTimes: 0
   isSoulUnstable: 0
   soulUnstableTime: 0
   criticalChance: 0
@@ -921,6 +922,7 @@ MonoBehaviour:
   jumpSpeed: 20
   airJumpSpeed: 17
   rushSpeed: 40
+  flySpeed: 8
   mp: 0
   totalMp: 300
   mpReplySpeed: 12
@@ -979,9 +981,12 @@ MonoBehaviour:
   LBisHold: 0
   isUltimate: 0
   isMpRepel: 1
+  maxFlyHeight: 0
   endTranSummon: 1
   canArrowHitFloat: 0
   probability: 0
+  gainAbilityProbability: 0
+  abilityTimes: 0
 --- !u!54 &3571941038519084339
 Rigidbody:
   m_ObjectHideFlags: 0
@@ -1689,6 +1694,8 @@ MonoBehaviour:
   offsetY: 1
   hitRate: 1
   Miss: {fileID: 6380148097413123628, guid: b0832b9907489bd44a617b760ccfd8c8, type: 3}
+  criticalRandom: 0
+  isRandom: 0
 --- !u!1 &9046555753133816952
 GameObject:
   m_ObjectHideFlags: 0

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

@@ -156,7 +156,10 @@ public class Bullet : MonoBehaviour
                     if (toFloat)
                     {
                         owner.attackToFloat = false;
-                        owner.floatTimes += 1;
+                        if (owner.floatTimes != -1)
+                        {
+                            owner.floatTimes += 1;
+                        }
                         toFloat = false;
                         if (hitTrigger.tag != "EnemyTower")
                         {

+ 1 - 1
ActionTowerDefense/Assets/Scripts/Character.cs

@@ -212,7 +212,7 @@ public class Character : MonoBehaviour
         }
         GameObject bulletObj = PoolManager.Instantiate(bulletPrefab);
         Bullet bullet = bulletObj.GetComponent<Bullet>();
-        if (attackToFloat && hasFloatTimes < floatTimes)
+        if (attackToFloat && (floatTimes == -1 || hasFloatTimes < floatTimes))
         {
             bullet.toFloat = true;
         }

+ 2 - 1
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -53,6 +53,7 @@ public class PlayerController : MoveCharacter
     //public float moveAcc = 5f;
     //public float airMoveAcc = 3f;
     public float rushSpeed = 100;
+    public float flySpeed = 5;
     public float mp;
     public float totalMp;
     public float mpReplySpeed = 1;
@@ -1423,7 +1424,7 @@ public class PlayerController : MoveCharacter
         CheckTurn();
         if (canfly)
         {
-            velocity = leftDir.normalized * moveSpeed;
+            velocity = leftDir.normalized * flySpeed;
             if (transform.position.y > maxFlyHeight && velocity.y > 0)
             {
                 velocity.y = 0;

+ 6 - 1
ActionTowerDefense/Assets/Scripts/Spirits/Spirits_Float.cs

@@ -10,13 +10,18 @@ public class Spirits_Float : MonoBehaviour
     private float curHeight;
     private float speed = 1;
     private Vector3 origPos;
+    public float floatProbability;          //漂浮概率
+    public int abilityTimes;                //攻击使漂浮的次数
 
     private void Start()
     {
         origPos = transform.position;
         curHeight = origPos.y;
         height = Random.Range(minHeight, maxHeight);
-        GetComponent<Demonic>().flyHeight = height;
+        Demonic dem = GetComponent<Demonic>();
+        dem.flyHeight = height;
+        dem.floatProbability = floatProbability;
+        dem.floatTimes = abilityTimes;
     }
 
     private void MoveToHeight()