Ver código fonte

修改了火球烟雾的粒子效果

Callum 4 meses atrás
pai
commit
031d651d3b

+ 1 - 1
ActionTowerDefense/Assets/Resources/Prefab/Enemy/Enemy_1013.prefab

@@ -239,7 +239,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   owner: {fileID: 0}
-  arrow: {fileID: 5316768400973749761, guid: 8a5178766fbd01849b8d4384ca688cd7, type: 3}
+  arrow: {fileID: 775116544085328787, guid: b0593518d25973c41859696aef316f19, type: 3}
   num: 1
   angle: 0
   arrivalAngle: 0

+ 4 - 1
ActionTowerDefense/Assets/Resources/Prefab/Skills/FireBallShot.prefab

@@ -45,8 +45,11 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   owner: {fileID: 0}
-  fireBall: {fileID: 5316768400973749761, guid: 8a5178766fbd01849b8d4384ca688cd7, type: 3}
+  arrow: {fileID: 775116544085328787, guid: b0593518d25973c41859696aef316f19, type: 3}
   num: 1
   angle: 0
   arrivalAngle: 0
   damage: 10
+  tryy: 0
+  gravity: 9.8
+  speed: 0

Diferenças do arquivo suprimidas por serem muito extensas
+ 239 - 346
ActionTowerDefense/Assets/Resources/Prefab/Skills/Fireball.prefab


+ 1 - 1
ActionTowerDefense/Assets/Resources/Prefab/Skills/Fireball.prefab.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 8a5178766fbd01849b8d4384ca688cd7
+guid: b0593518d25973c41859696aef316f19
 PrefabImporter:
   externalObjects: {}
   userData: 

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

@@ -2,6 +2,7 @@
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
+using UnityEngine.Events;
 
 public enum BulletType
 {
@@ -52,6 +53,8 @@ public class Bullet : MonoBehaviour
     
     private bool isInVain;   //击中光球,攻击无效
 
+    public UnityAction OnBulletHit;
+
     private void Awake()
     {
         rb = GetComponent<Rigidbody>();
@@ -204,7 +207,9 @@ public class Bullet : MonoBehaviour
                             }
                             else
                             {
-                                gameObject.SetActive(false);
+                                if (isBulletMove)
+                                    gameObject.SetActive(false);
+                                else OnBulletHit?.Invoke();
                             }
                             break;
                         case BulletType.Penetrate:

+ 16 - 0
ActionTowerDefense/Assets/Scripts/Skills/FireBallController.cs

@@ -1,3 +1,4 @@
+using System.Collections;
 using UnityEngine;
 
 public class FireBallController : MonoBehaviour
@@ -20,17 +21,20 @@ public class FireBallController : MonoBehaviour
     private float journeyTime;         // 总飞行时间
     private float startTime;           // 开始时间
     private Vector3 initialVelocity;   // 初始速度
+    public GameObject fx;
 
     private void Awake()
     {
         // 确保组件存在
         if (rb == null)
             rb = GetComponent<Rigidbody>();
+        gameObject.GetComponent<Bullet>().OnBulletHit += PushMe;
     }
 
     private void OnEnable()
     {
         isFlying = false;
+        fx.SetActive(true);
     }
 
     // 初始化发射
@@ -153,4 +157,16 @@ public class FireBallController : MonoBehaviour
     {
         gravity = newGravity;
     }
+
+    public void PushMe()
+    {
+        StartCoroutine(PushBullet());
+    }
+
+    IEnumerator PushBullet()
+    {
+        fx.SetActive(false);
+        yield return new WaitForSeconds(1);
+        gameObject.SetActive(false);
+    }
 }

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff