Эх сурвалжийг харах

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

Callum 4 сар өмнө
parent
commit
031d651d3b

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

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

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

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

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 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
 fileFormatVersion: 2
-guid: 8a5178766fbd01849b8d4384ca688cd7
+guid: b0593518d25973c41859696aef316f19
 PrefabImporter:
 PrefabImporter:
   externalObjects: {}
   externalObjects: {}
   userData: 
   userData: 

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

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

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

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

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно