瀏覽代碼

光球吸收伤害

LAPTOP-OM1V99U2\永远de小亡灵 11 月之前
父節點
當前提交
c3d8f6fa9c

+ 16 - 2
ActionTowerDefense/Assets/Resources/Prefab/Conduct/Photosphere.prefab

@@ -9,6 +9,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1639900831015566504}
+  - component: {fileID: 471243943054815319}
   m_Layer: 0
   m_Name: Photosphere
   m_TagString: Untagged
@@ -33,6 +34,19 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &471243943054815319
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 256012001268456902}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 7f05745e0e6d2be409434d91f3900653, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  stayTime: 10
 --- !u!1 &1373031044951819773
 GameObject:
   m_ObjectHideFlags: 0
@@ -59,7 +73,7 @@ Transform:
   m_GameObject: {fileID: 1373031044951819773}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 2, y: 2, z: 2}
+  m_LocalScale: {x: 3, y: 3, z: 3}
   m_ConstrainProportionsScale: 1
   m_Children: []
   m_Father: {fileID: 1639900831015566504}
@@ -159,7 +173,7 @@ CapsuleCollider:
   m_Material: {fileID: 0}
   m_IsTrigger: 1
   m_Enabled: 1
-  m_Radius: 1
+  m_Radius: 1.5
   m_Height: 20
   m_Direction: 2
   m_Center: {x: 0, y: 0, z: 0}

+ 8 - 0
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Assassin.prefab

@@ -232,6 +232,7 @@ MonoBehaviour:
   searchTrigger: {fileID: 5104552355235513707}
   bodyCollider: {fileID: 8367450352918568419}
   uiHp: {fileID: 6433555643392153575}
+  beHitTrigger: {fileID: 5333142802677931907}
   state: 0
   totalHp: 3000
   hp: 0
@@ -243,6 +244,8 @@ MonoBehaviour:
   invincibleTime: 0
   injuryNumText: {fileID: 6467251191553420251, guid: 9b37289f93ea76745ab2cefb79a93e3c, type: 3}
   showInjuryNum: 1
+  ls: {fileID: 0}
+  isInSoulTower: 0
   totalDieKeepTime: 0
   dieKeepTime: 0
   canHitFly: 0
@@ -300,6 +303,7 @@ MonoBehaviour:
   weakTime: 0
   totalWeakTime: 5
   weakHitRate: 2
+  weakForce: {x: 0, y: 0, z: 0}
   easyToGetHit: 0.2
   isDamageReduction: 0
   reductionDegree: 0
@@ -352,6 +356,9 @@ MonoBehaviour:
   maxMoveSpeed: 15
   minMoveSpeed: 10
   runSpeed: 0
+  isBeBlownUp: 0
+  isBeReboundedX: 0
+  isBeReboundedY: 0
   type: 1
   searchState: 0
   attackDistance: 1.5
@@ -380,6 +387,7 @@ MonoBehaviour:
   rushHaveAttack: 1
   downRushTime: 0.8
   finishRushTime: 2
+  upFirstAfterWeaknessOrNot: 0
 --- !u!1 &2437299196663985757
 GameObject:
   m_ObjectHideFlags: 0

+ 6 - 0
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Cook.prefab

@@ -817,6 +817,7 @@ MonoBehaviour:
   searchTrigger: {fileID: 2932762729738363159}
   bodyCollider: {fileID: 4543619153787591511}
   uiHp: {fileID: 5991788786426416620}
+  beHitTrigger: {fileID: 3377671071202039733}
   state: 0
   totalHp: 1000
   hp: 0
@@ -889,6 +890,7 @@ MonoBehaviour:
   weakTime: 0
   totalWeakTime: 0
   weakHitRate: 2
+  weakForce: {x: 0, y: 0, z: 0}
   easyToGetHit: 0.2
   isDamageReduction: 0
   reductionDegree: 0
@@ -941,6 +943,9 @@ MonoBehaviour:
   maxMoveSpeed: 2
   minMoveSpeed: 1
   runSpeed: 4
+  isBeBlownUp: 0
+  isBeReboundedX: 0
+  isBeReboundedY: 0
   type: 2
   searchState: 0
   attackDistance: 1.5
@@ -969,6 +974,7 @@ MonoBehaviour:
   rushHaveAttack: 0
   downRushTime: 0.8
   finishRushTime: 0.8
+  upFirstAfterWeaknessOrNot: 0
 --- !u!1 &6026815487321357762
 GameObject:
   m_ObjectHideFlags: 0

+ 5 - 0
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Float.prefab

@@ -1022,6 +1022,7 @@ MonoBehaviour:
   searchTrigger: {fileID: 3566347593191160092}
   bodyCollider: {fileID: 2616922587087395095}
   uiHp: {fileID: 3586716274361854270}
+  beHitTrigger: {fileID: 9020361017135710302}
   state: 0
   totalHp: 2000
   hp: 0
@@ -1108,6 +1109,7 @@ MonoBehaviour:
   weakTime: 0
   totalWeakTime: 10
   weakHitRate: 2
+  weakForce: {x: 0, y: 0, z: 0}
   easyToGetHit: 0.2
   isDamageReduction: 0
   reductionDegree: 0
@@ -1160,6 +1162,9 @@ MonoBehaviour:
   maxMoveSpeed: 12
   minMoveSpeed: 8
   runSpeed: 0
+  isBeBlownUp: 0
+  isBeReboundedX: 0
+  isBeReboundedY: 0
   type: 0
   searchState: 0
   attackDistance: 10

+ 8 - 0
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Invisible.prefab

@@ -235,6 +235,7 @@ MonoBehaviour:
   searchTrigger: {fileID: 5104552355235513707}
   bodyCollider: {fileID: 8367450352918568419}
   uiHp: {fileID: 6433555643392153575}
+  beHitTrigger: {fileID: 5333142802677931907}
   state: 0
   totalHp: 5000
   hp: 0
@@ -246,6 +247,8 @@ MonoBehaviour:
   invincibleTime: 0
   injuryNumText: {fileID: 6467251191553420251, guid: 9b37289f93ea76745ab2cefb79a93e3c, type: 3}
   showInjuryNum: 1
+  ls: {fileID: 0}
+  isInSoulTower: 0
   totalDieKeepTime: 0
   dieKeepTime: 0
   canHitFly: 0
@@ -300,6 +303,7 @@ MonoBehaviour:
   weakTime: 0
   totalWeakTime: 10
   weakHitRate: 2
+  weakForce: {x: 0, y: 0, z: 0}
   easyToGetHit: 0.2
   isDamageReduction: 0
   reductionDegree: 0
@@ -352,6 +356,9 @@ MonoBehaviour:
   maxMoveSpeed: 12
   minMoveSpeed: 8
   runSpeed: 0
+  isBeBlownUp: 0
+  isBeReboundedX: 0
+  isBeReboundedY: 0
   type: 3
   searchState: 0
   attackDistance: 10
@@ -380,6 +387,7 @@ MonoBehaviour:
   rushHaveAttack: 0
   downRushTime: 0
   finishRushTime: 0
+  upFirstAfterWeaknessOrNot: 0
 --- !u!1 &2437299196663985757
 GameObject:
   m_ObjectHideFlags: 0

+ 5 - 0
ActionTowerDefense/Assets/Resources/Prefab/EnemyTower.prefab

@@ -299,6 +299,7 @@ MonoBehaviour:
   searchTrigger: {fileID: 3581793009074591734}
   bodyCollider: {fileID: 0}
   uiHp: {fileID: 3581793008612699030}
+  beHitTrigger: {fileID: 3581793009363734221}
   state: 0
   totalHp: 20000
   hp: 0
@@ -310,6 +311,8 @@ MonoBehaviour:
   invincibleTime: 0
   injuryNumText: {fileID: 6467251191553420251, guid: 9b37289f93ea76745ab2cefb79a93e3c, type: 3}
   showInjuryNum: 1
+  ls: {fileID: 0}
+  isInSoulTower: 0
   totalDieKeepTime: 2
   dieKeepTime: 0
   canHitFly: 0
@@ -345,6 +348,8 @@ MonoBehaviour:
   cookEffect: {fileID: 0}
   attack1ShootCanTransmit: 0
   height: 8
+  haveDisappearTime: 0
+  disappearTime: 0
 --- !u!54 &3581793008941702771
 Rigidbody:
   m_ObjectHideFlags: 0

+ 5 - 0
ActionTowerDefense/Assets/Resources/Prefab/Enemy_Arrow.prefab

@@ -983,6 +983,7 @@ MonoBehaviour:
   searchTrigger: {fileID: 3566347593191160092}
   bodyCollider: {fileID: 2616922587087395095}
   uiHp: {fileID: 3586716274361854270}
+  beHitTrigger: {fileID: 9020361017135710302}
   state: 0
   totalHp: 100
   hp: 0
@@ -1065,6 +1066,7 @@ MonoBehaviour:
   weakTime: 0
   totalWeakTime: 10
   weakHitRate: 2
+  weakForce: {x: 0, y: 0, z: 0}
   easyToGetHit: 0.2
   isDamageReduction: 0
   reductionDegree: 0
@@ -1117,6 +1119,9 @@ MonoBehaviour:
   maxMoveSpeed: 12
   minMoveSpeed: 8
   runSpeed: 0
+  isBeBlownUp: 0
+  isBeReboundedX: 0
+  isBeReboundedY: 0
   type: -1
   searchState: 0
   attackDistance: 10

+ 11 - 1
ActionTowerDefense/Assets/Resources/Prefab/Enemy_Giant.prefab

@@ -99,6 +99,7 @@ MonoBehaviour:
   repelValue: 0
   offsetY: 1
   hitRate: 1
+  isInVain: 0
 --- !u!1 &2460330936527559963
 GameObject:
   m_ObjectHideFlags: 0
@@ -441,6 +442,7 @@ MonoBehaviour:
   searchTrigger: {fileID: 2932762729738363159}
   bodyCollider: {fileID: 4543619153787591511}
   uiHp: {fileID: 478072938412589135}
+  beHitTrigger: {fileID: 3377671071202039733}
   state: 0
   totalHp: 100
   hp: 0
@@ -452,6 +454,8 @@ MonoBehaviour:
   invincibleTime: 0
   injuryNumText: {fileID: 6467251191553420251, guid: 9b37289f93ea76745ab2cefb79a93e3c, type: 3}
   showInjuryNum: 1
+  ls: {fileID: 0}
+  isInSoulTower: 0
   totalDieKeepTime: 0
   dieKeepTime: 0
   canHitFly: 1
@@ -509,6 +513,7 @@ MonoBehaviour:
   weakTime: 0
   totalWeakTime: 10
   weakHitRate: 2
+  weakForce: {x: 0, y: 0, z: 0}
   easyToGetHit: 0.2
   isDamageReduction: 0
   reductionDegree: 0
@@ -550,8 +555,9 @@ MonoBehaviour:
   sustainedInjuryTime: 0
   sustainedInjury_IntervalTime: 0
   sustainedInjury_damage: 0
+  heavyDamage: 0
   id: 0
-  sortingOrder: 0
+  baseSortingOrder: 0
   canFly: 0
   isBack: 0
   flyHeight: 0
@@ -560,6 +566,9 @@ MonoBehaviour:
   maxMoveSpeed: 2
   minMoveSpeed: 1
   runSpeed: 0
+  isBeBlownUp: 0
+  isBeReboundedX: 0
+  isBeReboundedY: 0
   type: -1
   searchState: 0
   attackDistance: 3
@@ -588,6 +597,7 @@ MonoBehaviour:
   rushHaveAttack: 0
   downRushTime: 0
   finishRushTime: 0
+  upFirstAfterWeaknessOrNot: 0
 --- !u!54 &5440846222648032765
 Rigidbody:
   m_ObjectHideFlags: 0

+ 10 - 0
ActionTowerDefense/Assets/Resources/Prefab/Enemy_Sword.prefab

@@ -173,6 +173,7 @@ MonoBehaviour:
   repelValue: 0
   offsetY: 1
   hitRate: 1
+  isInVain: 0
 --- !u!1 &2437299196472462361
 GameObject:
   m_ObjectHideFlags: 0
@@ -231,6 +232,7 @@ MonoBehaviour:
   searchTrigger: {fileID: 428784489592146076}
   bodyCollider: {fileID: 7970625495845499240}
   uiHp: {fileID: 5757877461832872043}
+  beHitTrigger: {fileID: 6427563181875878110}
   state: 0
   totalHp: 500
   hp: 0
@@ -242,6 +244,8 @@ MonoBehaviour:
   invincibleTime: 0
   injuryNumText: {fileID: 6467251191553420251, guid: 9b37289f93ea76745ab2cefb79a93e3c, type: 3}
   showInjuryNum: 1
+  ls: {fileID: 0}
+  isInSoulTower: 0
   totalDieKeepTime: 0
   dieKeepTime: 0
   canHitFly: 1
@@ -299,6 +303,7 @@ MonoBehaviour:
   weakTime: 0
   totalWeakTime: 10
   weakHitRate: 2
+  weakForce: {x: 0, y: 0, z: 0}
   easyToGetHit: 0.2
   isDamageReduction: 0
   reductionDegree: 0
@@ -340,6 +345,7 @@ MonoBehaviour:
   sustainedInjuryTime: 0
   sustainedInjury_IntervalTime: 0
   sustainedInjury_damage: 0
+  heavyDamage: 0
   id: 0
   baseSortingOrder: 3000
   canFly: 0
@@ -350,6 +356,9 @@ MonoBehaviour:
   maxMoveSpeed: 6
   minMoveSpeed: 5
   runSpeed: 0
+  isBeBlownUp: 0
+  isBeReboundedX: 0
+  isBeReboundedY: 0
   type: -1
   searchState: 0
   attackDistance: 1.5
@@ -378,6 +387,7 @@ MonoBehaviour:
   rushHaveAttack: 0
   downRushTime: 0
   finishRushTime: 0
+  upFirstAfterWeaknessOrNot: 0
 --- !u!54 &2437299196472462355
 Rigidbody:
   m_ObjectHideFlags: 0

+ 30 - 8
ActionTowerDefense/Assets/Scripts/AttackTrigger.cs

@@ -13,6 +13,7 @@ public class AttackTrigger : MonoBehaviour
     public float repelValue;
     public int offsetY = 1;
     public float hitRate = 1;
+    private bool isInVain;   //»÷ÖйâÇò£¬¹¥»÷ÎÞЧ
 
     private void Awake()
     {
@@ -21,6 +22,17 @@ public class AttackTrigger : MonoBehaviour
     }
     private void OnTriggerEnter(Collider other)
     {
+        if (isInVain)
+        {
+            return;
+        }
+        Photosphere photosphere = other.GetComponentInParent<Photosphere>();
+        if (photosphere && Util.CheckCanHit(owner.tag, "Player"))
+        {
+            isInVain = true;
+            photosphere.Reflex(owner.beHitTrigger);
+            return;
+        }
         BeHitTrigger hitTrigger = other.GetComponent<BeHitTrigger>();
         if (hitTrigger != null)
         {
@@ -36,21 +48,31 @@ public class AttackTrigger : MonoBehaviour
             if (!triged)
             {
                 trigedObjs.Add(hitTrigger);
-                if (Util.CheckCanHit(owner.tag, hitTrigger.owner.tag) && !hitTrigger.owner.isDie)
+
+            }
+        }
+    }
+
+    private void OnEnable()
+    {
+        if (isInVain)
+        {
+            isInVain = false;
+        }
+        else
+        {
+            for (int i = 0; i < trigedObjs.Count; i++)
+            {
+                if (trigedObjs[i] && Util.CheckCanHit(owner.tag, trigedObjs[i].owner.tag) && !trigedObjs[i].owner.isDie)
                 {
-                    hitTrigger.BeHit(damage, force, changeHurt, repelValue);
+                    trigedObjs[i].BeHit(damage, force, changeHurt, repelValue);
                     if (owner.GetComponent<Demonic>())
                     {
-                        hitTrigger.attackerID = owner.GetComponent<Demonic>().id;
+                        trigedObjs[i].attackerID = owner.GetComponent<Demonic>().id;
                     }
                 }
             }
         }
-    }
-
-    private void OnEnable()
-    {
-        hitRate = 1;
         trigedObjs.Clear();
     }
 }

+ 57 - 39
ActionTowerDefense/Assets/Scripts/Bullet.cs

@@ -30,7 +30,7 @@ public class Bullet : MonoBehaviour
     public bool isBack;                 //回旋镖,会回来
     public float stayTime;              //在极点处停留时长
     private bool isStay = false;
-    private Vector3 curDir;
+    //private Vector3 curDir;
     private bool hasBack = false;       //已经回来了
 
     [Header("传送门")]
@@ -39,10 +39,11 @@ public class Bullet : MonoBehaviour
     [HideInInspector]
     public float transmitTime;          //传送CD
     public PortalsController portalsController;
+    
+    private bool isInVain;   //击中光球,攻击无效
 
     private void Awake()
     {
-        //owner = GetComponentInParent<Character>();
         rb = GetComponent<Rigidbody>();
     }
     private void Update()
@@ -61,36 +62,43 @@ public class Bullet : MonoBehaviour
     private void FixedUpdate()
     {
         flyTime += Time.deltaTime;
-        if (!isStay && flyTime >= maxFlyTime)
+        if(flyTime >= maxFlyTime)
         {
-            if (!isBack)
-            {
-                isGetTarget = true;
-                gameObject.SetActive(false);
-                return;
-            }
-            else
-            {
-                isStay = true;
-                flyTime = 0;
-                rb.velocity = Vector3.zero;
-            }
-        }
-        if(isStay && flyTime >= stayTime)
-        {
-            isStay = false;
-            hasBack = true;
-            trackTarget = owner;
-        }
-        if (hasBack)
-        {
-            if (owner.gameObject.activeSelf == false)
-            {
-                isStay = true;
-                flyTime = 0;
-                rb.velocity = Vector3.zero;
-            }
+            isGetTarget = true;
+            gameObject.SetActive(false);
+            return;
         }
+        //回旋镖
+        //if (!isStay && flyTime >= maxFlyTime)
+        //{
+        //    if (!isBack)
+        //    {
+        //        isGetTarget = true;
+        //        gameObject.SetActive(false);
+        //        return;
+        //    }
+        //    else
+        //    {
+        //        isStay = true;
+        //        flyTime = 0;
+        //        rb.velocity = Vector3.zero;
+        //    }
+        //}
+        //if(isStay && flyTime >= stayTime)
+        //{
+        //    isStay = false;
+        //    hasBack = true;
+        //    trackTarget = owner;
+        //}
+        //if (hasBack)
+        //{
+        //    if (owner.gameObject.activeSelf == false)
+        //    {
+        //        isStay = true;
+        //        flyTime = 0;
+        //        rb.velocity = Vector3.zero;
+        //    }
+        //}
         if (isTrack && trackTarget != null && !trackTarget.isDie && trackTarget.gameObject.activeInHierarchy)
         {
             Vector3 tarDir = (trackTarget.beSearchTrigger.transform.position - transform.position).normalized;
@@ -114,24 +122,34 @@ public class Bullet : MonoBehaviour
         isTrack = track;
         trackTarget = target;
         flyTime = 0;
-        curDir = dir;
+        //curDir = dir;
     }
 
     private void OnTriggerEnter(Collider other)
     {
-        if (other.GetComponentInParent<Character>() == owner)
+
+        if (isGetTarget || isInVain)
         {
-            if (hasBack)
-            {
-                isGetTarget = true;
-                gameObject.SetActive(false);
-                return;
-            }
+            return;
         }
-        if (isGetTarget)
+        Photosphere photosphere = other.GetComponentInParent<Photosphere>();
+        if (photosphere && Util.CheckCanHit(owner.tag, "Player"))
         {
+            isInVain = true;
+            photosphere.Reflex(owner.beHitTrigger);
+            gameObject.SetActive(false);
             return;
         }
+        //回旋镖
+        //if (other.GetComponentInParent<Character>() == owner)
+        //{
+        //    if (hasBack)
+        //    {
+        //        isGetTarget = true;
+        //        gameObject.SetActive(false);
+        //        return;
+        //    }
+        //}
         BeHitTrigger hitTrigger = other.GetComponent<BeHitTrigger>();
         if (hitTrigger != null)
         {

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

@@ -72,6 +72,7 @@ public class Character : MonoBehaviour
     public SearchTrigger searchTrigger;
     public GameObject bodyCollider;
     public UIHP uiHp;
+    public BeHitTrigger beHitTrigger;
 
     [Header("½Çɫ״̬")]
     public CharacterState state;

+ 10 - 6
ActionTowerDefense/Assets/Scripts/Conduct/Photosphere.cs

@@ -4,15 +4,19 @@ using UnityEngine;
 
 public class Photosphere : MonoBehaviour
 {
-    // Start is called before the first frame update
-    void Start()
+    public float stayTime;
+    private float time;
+    private void Update()
     {
-        
+        time += Time.deltaTime;
+        if (time >= stayTime)
+        {
+            gameObject.SetActive(false);
+        }
     }
 
-    // Update is called once per frame
-    void Update()
+    public void Reflex(BeHitTrigger beHitTrigger)
     {
-        
+        print("reflex");
     }
 }