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

变身隐身解除后使周围使魔短暂无敌

LAPTOP-OM1V99U2\永远de小亡灵 1 жил өмнө
parent
commit
6dc88fbf64

+ 17 - 1
ActionTowerDefense/Assets/Resources/Prefab/FX/InvisibleEffectRange.prefab

@@ -10,6 +10,7 @@ GameObject:
   m_Component:
   - component: {fileID: 6831563428749086452}
   - component: {fileID: 8409860499344876540}
+  - component: {fileID: 7675852806436775241}
   m_Layer: 0
   m_Name: InvisibleEffectRange
   m_TagString: Untagged
@@ -46,6 +47,21 @@ BoxCollider:
   serializedVersion: 2
   m_Size: {x: 1, y: 100, z: 20}
   m_Center: {x: 0, y: 0, z: 0}
+--- !u!114 &7675852806436775241
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 417478504669294145}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 61a6e5389dd9c1047b12b24be3f44871, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  ps: {fileID: 0}
+  moveCharacters: []
+  invincibleTime: 3
 --- !u!1 &746774320722880007
 GameObject:
   m_ObjectHideFlags: 0
@@ -269,7 +285,7 @@ ParticleSystem:
       serializedVersion: 2
       minMaxState: 0
       minColor: {r: 1, g: 1, b: 1, a: 1}
-      maxColor: {r: 1, g: 1, b: 1, a: 1}
+      maxColor: {r: 1, g: 1, b: 0, a: 1}
       maxGradient:
         serializedVersion: 2
         key0: {r: 1, g: 1, b: 1, a: 1}

+ 1 - 18
ActionTowerDefense/Assets/Resources/Prefab/MySpirit/Spirits_Invisible.prefab

@@ -165,7 +165,6 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 2437299196472462364}
-  - component: {fileID: 6801157681521274923}
   - component: {fileID: 2437299196472462353}
   - component: {fileID: 2472120008162019348}
   m_Layer: 12
@@ -191,22 +190,6 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!114 &6801157681521274923
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 2437299196472462361}
-  m_Enabled: 0
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 0a404b1e6e4d077448ed17eaef088ae7, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
-  demonic: {fileID: 2437299196472462353}
-  player: {fileID: 0}
-  canInvincible: 0
-  maxFlyHeight: 10
 --- !u!114 &2437299196472462353
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -338,7 +321,7 @@ MonoBehaviour:
   soulPrefab: {fileID: 0}
   soulStartSpeed: 1
   easyToGetHit: 0.2
-  canNotBeHit: 0
+  isInvincible: 0
   player: {fileID: 0}
   id: 0
   costMp: 1

+ 10 - 2
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -325,16 +325,24 @@ public class MoveCharacter : Character
                 ChangeMat(1);
             }
         }
+        if (isInvincible)
+        {
+            invincibleTime -= Time.deltaTime;
+            if(invincibleTime <= 0)
+            {
+                isInvincible = false;
+            }
+        }
     }
 
     public float easyToGetHit = 0.2f;
-    public bool canNotBeHit;
+    public bool isInvincible;
 
     public override void BeHit(int damage, Vector3 force, bool changeHurt, float repelValue)
     {
         if (!isTran)
         {
-            if (canNotBeHit)
+            if (isInvincible)
             {
                 return;
             }

+ 48 - 0
ActionTowerDefense/Assets/Scripts/Spirits/InvisibleEffect.cs

@@ -0,0 +1,48 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class InvisibleEffect : MonoBehaviour
+{
+    [HideInInspector]
+    public ParticleSystem ps;
+    public List<MoveCharacter> moveCharacters = new List<MoveCharacter>();
+    public float invincibleTime;
+
+    private void Start()
+    {
+        ps = transform.GetChild(0).GetComponent<ParticleSystem>();
+    }
+
+    private void OnTriggerEnter(Collider other)
+    {
+        if (other.gameObject.layer == 7 || other.gameObject.layer == 6)
+        {
+            
+            MoveCharacter moveCharacter = other.GetComponentInParent<MoveCharacter>();
+            if (moveCharacters.Exists(t => t == moveCharacter))
+            {
+                return;
+            }
+            moveCharacters.Add(moveCharacter);
+            if (moveCharacter.isTran)
+            {
+                if (moveCharacter.pc == null)
+                {
+                    moveCharacter.pc = moveCharacter.GetComponentInParent<PlayerController>();
+                }
+                moveCharacter = moveCharacter.pc;
+            }
+            moveCharacter.isInvincible = true;
+            moveCharacter.invincibleTime = invincibleTime;
+        }
+    }
+
+    private void Update()
+    {
+        if (ps.isStopped)
+        {
+            gameObject.SetActive(false);
+        }
+    }
+}

+ 11 - 0
ActionTowerDefense/Assets/Scripts/Spirits/InvisibleEffect.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 61a6e5389dd9c1047b12b24be3f44871
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 13 - 0
ActionTowerDefense/Assets/Scripts/Spirits/Trans_Invisible.cs

@@ -11,6 +11,7 @@ public class Trans_Invisible : MonoBehaviour
     //public float changeTime;
     public bool canInvincible;
     public float maxFlyHeight;
+    public GameObject invisibleEffect;
 
     //public float addMp;
     //public InvisibleSoulCollector soulCollector;
@@ -60,6 +61,18 @@ public class Trans_Invisible : MonoBehaviour
         //    playerController.beTargetCharacter[i].targetCharacter = null;
         //}
     }
+    private void Update()
+    {
+        if (player.isUltimate)
+        {
+            player.isUltimate = false;
+            GameObject effect = Instantiate(invisibleEffect);
+            effect.transform.position = transform.position;
+            
+            player.EndTransfiguration(6);
+            
+        }
+    }
     /*
     private void Update()
     {