Browse Source

墙能被撞坏

WGL 4 tháng trước cách đây
mục cha
commit
6a7e580799

+ 12 - 6
ActionTowerDefense/Assets/Resources/Prefab/MySoldier/Demonic_Arrow.prefab

@@ -684,6 +684,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 5eaed0a6b9d6fc6409bef80cf41a0a8e, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  canBreakWall: 0
   isShoot: 1
   type: 0
   owner: {fileID: 0}
@@ -736,7 +737,6 @@ MonoBehaviour:
   repelValue: 0
   offsetY: 1
   hitRate: 1
-  onlyFlyCanWeak: 0
 --- !u!1 &5307676761346103599
 GameObject:
   m_ObjectHideFlags: 0
@@ -1131,8 +1131,10 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   rb: {fileID: 0}
+  moveCharacter: {fileID: 0}
   haveGravity: 1
   trigGroundList: []
+  platform: {fileID: 0}
 --- !u!1 &8639832132491289359
 GameObject:
   m_ObjectHideFlags: 0
@@ -1191,6 +1193,7 @@ MonoBehaviour:
   uiHp: {fileID: 3586716274361854270}
   beHitTrigger: {fileID: 9020361017135710302}
   attackController: {fileID: 6589564398742701796}
+  platform: {fileID: 0}
   mecanim: {fileID: 3354085511906294621}
   meshRenderer: {fileID: 0}
   ani: {fileID: 5978259926173120695}
@@ -1215,6 +1218,7 @@ MonoBehaviour:
   isBeHitBySummonAttack: 0
   showInjuryNum: 0
   canFly: 1
+  nowCanFly: 0
   statePre: {fileID: 4272231268506418309, guid: cf5ca93704f49c744b0d6cfc2cd25a01, type: 3}
   ls: {fileID: 0}
   isInSoulTower: 0
@@ -1230,6 +1234,11 @@ MonoBehaviour:
   foot: {fileID: 8639832132450015562}
   attributeStatus: {fileID: 0}
   hitFeedbackSystem: {fileID: 0}
+  extraRiseGravity: -28.8
+  extraFallGravity: -14.4
+  extraGroundGravity: -28.8
+  velocityAddition: 0
+  platformY: 0
   hitResistance: 0
   matState: 1
   spinee: {fileID: 0}
@@ -1239,8 +1248,6 @@ MonoBehaviour:
   - {fileID: 2100000, guid: b634d447d9a02a14abc964532eedfc35, type: 2}
   outline1Mats:
   - {fileID: 2100000, guid: 916bb121eaeae3b43914636f946abdcd, type: 2}
-  extraRiseGravity: -28.8
-  extraFallGravity: -14.4
   moveSpeed: 5
   needToAdjustFlyHeight: 1
   flyHeight: 0
@@ -1256,7 +1263,6 @@ MonoBehaviour:
   soulStartSpeed: 1
   isInvisible: 0
   invisibleTime: 0
-  velocityAddition: 0
   haveTransmit: 0
   transmitTime: 0
   portalsController: {fileID: 0}
@@ -1266,6 +1272,8 @@ MonoBehaviour:
   sustainedInjury_damage: 0
   heavyDamage: 0
   killer: {fileID: 0}
+  searchState: 0
+  attackTrigger: {fileID: 5755692021491134919}
   soldierType: 1
   player: {fileID: 0}
   playerID: 0
@@ -1278,8 +1286,6 @@ MonoBehaviour:
   isReturnSoulTower: 0
   origSoulPos: {x: 0, y: 0, z: 0}
   isRecorded: 0
-  searchState: 0
-  soulCollector: {fileID: 0}
   curAttackID: 0
   adsorbSpeed: 0
   adsorbTarget: {x: 0, y: 0, z: 0}

+ 8 - 3
ActionTowerDefense/Assets/Resources/Prefab/MySoldier/Demonic_Giant.prefab

@@ -91,6 +91,8 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 5eaed0a6b9d6fc6409bef80cf41a0a8e, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  canBreakWall: 1
+  num: 10
   isShoot: 0
   type: 0
   owner: {fileID: 0}
@@ -143,7 +145,6 @@ MonoBehaviour:
   repelValue: 0
   offsetY: 1
   hitRate: 1
-  onlyFlyCanWeak: 0
 --- !u!1 &2460330936527559963
 GameObject:
   m_ObjectHideFlags: 0
@@ -520,6 +521,7 @@ MonoBehaviour:
   moveCharacter: {fileID: 0}
   haveGravity: 1
   trigGroundList: []
+  platform: {fileID: 0}
 --- !u!1 &5440846222648032759
 GameObject:
   m_ObjectHideFlags: 0
@@ -657,6 +659,7 @@ MonoBehaviour:
   sustainedInjury_damage: 0
   heavyDamage: 0
   killer: {fileID: 0}
+  searchState: 0
   soldierType: 2
   player: {fileID: 0}
   playerID: 0
@@ -669,8 +672,6 @@ MonoBehaviour:
   isReturnSoulTower: 0
   origSoulPos: {x: 0, y: 0, z: 0}
   isRecorded: 0
-  searchState: 0
-  soulCollector: {fileID: 0}
   curAttackID: 0
   adsorbSpeed: 0.5
   adsorbTarget: {x: 0, y: 0, z: 0}
@@ -1496,6 +1497,10 @@ PrefabInstance:
   m_Modification:
     m_TransformParent: {fileID: 901824162977467732}
     m_Modifications:
+    - target: {fileID: 56796490675054764, guid: 12435a63399f44f4a919a57010981786, type: 3}
+      propertyPath: m_Enabled
+      value: 0
+      objectReference: {fileID: 0}
     - target: {fileID: 262311660969425103, guid: 12435a63399f44f4a919a57010981786, type: 3}
       propertyPath: m_RootOrder
       value: 5

+ 7 - 4
ActionTowerDefense/Assets/Resources/Prefab/MySoldier/Demonic_Sword.prefab

@@ -184,6 +184,7 @@ MonoBehaviour:
   uiHp: {fileID: 6433555643392153575}
   beHitTrigger: {fileID: 5333142802677931907}
   attackController: {fileID: 6797330787108410633}
+  platform: {fileID: 0}
   mecanim: {fileID: 5617185463097218335}
   meshRenderer: {fileID: 0}
   ani: {fileID: 6496896669866891404}
@@ -262,6 +263,9 @@ MonoBehaviour:
   sustainedInjury_damage: 0
   heavyDamage: 0
   killer: {fileID: 0}
+  searchState: 0
+  soulCollector: {fileID: 0}
+  attackTrigger: {fileID: 3063112574554332383}
   soldierType: 0
   player: {fileID: 0}
   playerID: 0
@@ -274,8 +278,6 @@ MonoBehaviour:
   isReturnSoulTower: 0
   origSoulPos: {x: 0, y: 0, z: 0}
   isRecorded: 0
-  searchState: 0
-  soulCollector: {fileID: 0}
   curAttackID: 0
   adsorbSpeed: 0
   adsorbTarget: {x: 0, y: 0, z: 0}
@@ -686,6 +688,7 @@ MonoBehaviour:
   moveCharacter: {fileID: 0}
   haveGravity: 1
   trigGroundList: []
+  platform: {fileID: 0}
 --- !u!1 &2888240249657181453
 GameObject:
   m_ObjectHideFlags: 0
@@ -744,6 +747,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 5eaed0a6b9d6fc6409bef80cf41a0a8e, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  canBreakWall: 0
   isShoot: 0
   type: 1
   owner: {fileID: 0}
@@ -796,7 +800,6 @@ MonoBehaviour:
   repelValue: 0
   offsetY: 1
   hitRate: 1
-  onlyFlyCanWeak: 1
 --- !u!1 &5216717017252562314
 GameObject:
   m_ObjectHideFlags: 0
@@ -1056,6 +1059,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 5eaed0a6b9d6fc6409bef80cf41a0a8e, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
+  canBreakWall: 0
   isShoot: 0
   type: 0
   owner: {fileID: 0}
@@ -1108,7 +1112,6 @@ MonoBehaviour:
   repelValue: 0
   offsetY: 1
   hitRate: 1
-  onlyFlyCanWeak: 1
 --- !u!1 &7669620205589286043
 GameObject:
   m_ObjectHideFlags: 0

+ 15 - 1
ActionTowerDefense/Assets/Resources/Prefab/test/TestWall.prefab

@@ -12,9 +12,10 @@ GameObject:
   - component: {fileID: 6311998647852931334}
   - component: {fileID: 4650717825501729688}
   - component: {fileID: 4061542183338241749}
+  - component: {fileID: 1481490731960139298}
   m_Layer: 0
   m_Name: Wall
-  m_TagString: Wall
+  m_TagString: Untagged
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
@@ -97,6 +98,19 @@ BoxCollider:
   serializedVersion: 2
   m_Size: {x: 1, y: 1, z: 1}
   m_Center: {x: 0, y: 0, z: 0}
+--- !u!114 &1481490731960139298
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2153530898131473404}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 7b90673e1c509ba41be19e00359e91ac, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  totalNum: 10
 --- !u!1 &8375663503630210449
 GameObject:
   m_ObjectHideFlags: 0

+ 9 - 20
ActionTowerDefense/Assets/Scripts/Characters/AttackTrigger.cs

@@ -2,6 +2,7 @@ using Base.Common;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
+using Sirenix.OdinInspector;
 
 public class AttackTrigger : MonoBehaviour
 {
@@ -11,6 +12,9 @@ public class AttackTrigger : MonoBehaviour
         march = 1,
     }
 
+    [FoldoutGroup("场景交互-墙")] [LabelText("能破墙")] public bool canBreakWall;
+    [FoldoutGroup("场景交互-墙")] public int num = 10;
+
     [Header("是否是远程角色")]
     public bool isShoot;
     public attackType type;
@@ -28,10 +32,7 @@ public class AttackTrigger : MonoBehaviour
     public float repelValue;
     public int offsetY = 1;
     public float hitRate = 1;
-    //private bool isInVain;   //击中光球,攻击无效
-    [Header("只有空中单位会被造成眩晕")]
-    public bool onlyFlyCanWeak;
-
+    
     private void Awake()
     {
         owner = GetComponentInParent<Character>();
@@ -39,19 +40,6 @@ 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, damage);
-        //    return;
-        //}
         if (!isShoot)
         {
             BeHitTrigger hitTrigger = other.GetComponent<BeHitTrigger>();
@@ -111,8 +99,9 @@ public class AttackTrigger : MonoBehaviour
 
     private void OnDisable()
     {
-
+        if (canBreakWall)
+        {
+            canBreakWall = false;
+        }
     }
 }
-
-//objectQIHSOUJNOUNERN HIHN HUJIJa

+ 4 - 4
ActionTowerDefense/Assets/Scripts/Characters/Demonic.cs

@@ -3,9 +3,13 @@ using Spine;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
+using Sirenix.OdinInspector;
+
 
 public class Demonic : MoveCharacter
 {
+    [FoldoutGroup("组件")] [DisplayOnly]public SearchState searchState;
+
     [Header("友方单位属性")]
     public SoldierType soldierType;      //当前士兵属于什么兵种
     public PlayerController player;      //召唤师
@@ -23,10 +27,6 @@ public class Demonic : MoveCharacter
     public Vector3 origSoulPos;
     public bool isRecorded;
 
-    [Header("友方单位组件")]
-    public SearchState searchState;
-    public Collider soulCollector;
-
     [Header("攻击")]
     [SerializeField]
     private int curAttackID;

+ 10 - 0
ActionTowerDefense/Assets/Scripts/Characters/Foot.cs

@@ -101,6 +101,11 @@ public class Foot : MonoBehaviour
             if (!trigGroundList.Exists(t => t == other.gameObject))
             {
                 trigGroundList.Add(other.gameObject);
+                Platform platform = other.GetComponent<Platform>();
+                if (platform!=null)
+                {
+                    platform.feet.Add(this);
+                }
             }
         }
     }
@@ -113,6 +118,11 @@ public class Foot : MonoBehaviour
             {
                 trigGroundList.RemoveAt(i);
                 i--;
+                Platform platform = other.GetComponent<Platform>();
+                if (platform != null)
+                {
+                    platform.feet.Remove(this);
+                }
             }
         }
     }

+ 5 - 1
ActionTowerDefense/Assets/Scripts/Characters/WallTrigger.cs

@@ -19,11 +19,13 @@ public class WallTrigger : MonoBehaviour
 
     private void OnTriggerEnter(Collider other)
     {
-        if (other.CompareTag("Wall"))
+        Wall wall = other.GetComponent<Wall>();
+        if (wall!=null)
         {
             if (!trigWallList.Exists(t => t == other.gameObject))
             {
                 trigWallList.Add(other.gameObject);
+                wall.wallTriggers.Add(this);
             }
         }
     }
@@ -36,6 +38,8 @@ public class WallTrigger : MonoBehaviour
             {
                 trigWallList.RemoveAt(i);
                 i--;
+                Wall wall = other.GetComponent<Wall>();
+                wall.wallTriggers.Remove(this);
             }
         }
     }

+ 8 - 0
ActionTowerDefense/Assets/Scripts/SceneInteraction.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a1eadeaafad70f04387989af5a5c6f9b
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 39 - 0
ActionTowerDefense/Assets/Scripts/SceneInteraction/Wall.cs

@@ -0,0 +1,39 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Wall : MonoBehaviour
+{
+    public int totalNum = 10;
+    public List<WallTrigger> wallTriggers;
+    
+    private void OnTriggerEnter(Collider other)
+    {
+        AttackTrigger attackTrigger = other.GetComponent<AttackTrigger>();
+        if (attackTrigger != null && attackTrigger.canBreakWall)
+        {
+            totalNum -= attackTrigger.num;
+            if (totalNum <= 0)
+            {
+                Break();
+            }
+        }
+    }
+
+    private void OnDisable()
+    {
+        foreach (var item in wallTriggers)
+        {
+            if (item.trigWallList.Exists(a => a == gameObject))
+            {
+                item.trigWallList.Remove(gameObject);
+            }
+        }
+    }
+
+    public void Break()
+    {
+        Destroy(gameObject);
+    }
+
+}

+ 11 - 0
ActionTowerDefense/Assets/Scripts/SceneInteraction/Wall.cs.meta

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

+ 0 - 1
ActionTowerDefense/ProjectSettings/TagManager.asset

@@ -14,7 +14,6 @@ TagManager:
   - Ground
   - Platform
   - Plane
-  - Wall
   layers:
   - Default
   - TransparentFX