Bladeren bron

平台新增能否被子弹穿透选项

WGL 4 maanden geleden
bovenliggende
commit
408e38d5a7
2 gewijzigde bestanden met toevoegingen van 10 en 3 verwijderingen
  1. 9 3
      ActionTowerDefense/Assets/Scripts/Bullet.cs
  2. 1 0
      ActionTowerDefense/Assets/Scripts/Platform.cs

+ 9 - 3
ActionTowerDefense/Assets/Scripts/Bullet.cs

@@ -122,10 +122,16 @@ public class Bullet : MonoBehaviour
         {
             return;
         }
-        if(bulletType == BulletType.Single && (other.CompareTag("Platform")|| other.CompareTag("Ground")))
+        Platform platform = other.GetComponent<Platform>();
+        if ((platform != null && !platform.canPenetrateBullets || other.CompareTag("Ground")))
         {
-            gameObject.SetActive(false);
-            return;
+            if (bulletType == BulletType.Single)
+            {
+                DisappearEffect();
+                gameObject.SetActive(false);
+                return;
+            }
+
         }
         BeHitTrigger hitTrigger = other.GetComponent<BeHitTrigger>();
         if (hitTrigger != null)

+ 1 - 0
ActionTowerDefense/Assets/Scripts/Platform.cs

@@ -12,6 +12,7 @@ public class Platform : MonoBehaviour
 
     [FoldoutGroup("条件")] [LabelText("是否可以下平台")] public bool canDown = true;
     [FoldoutGroup("条件")] [LabelText("是否优先行走")] public bool haveMagnetic;
+    [FoldoutGroup("条件")] [LabelText("是否可以穿透子弹")] public bool canPenetrateBullets;
 
     public bool TrigFeet
     {