瀏覽代碼

Merge remote-tracking branch 'origin/master'

SZAND\msx_2 7 月之前
父節點
當前提交
4d082e10ec
共有 25 個文件被更改,包括 518 次插入510 次删除
  1. 6 24
      ActionTowerDefense/Assets/Animations/Enemy_Sword/EnemySwordCollider_Attack1.anim
  2. 7 7
      ActionTowerDefense/Assets/Animations/Enemy_Sword/EnemySwordCollider_Attack2.anim
  3. 14 2
      ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/GameMapTile.cs
  4. 0 5
      ActionTowerDefense/Assets/GameLevelEditor/GameMap/Sample/Scripts/Main.cs
  5. 148 19
      ActionTowerDefense/Assets/GameLevelEditor/tiles.asset
  6. 11 11
      ActionTowerDefense/Assets/Gen/SingleEnemyConfig.cs
  7. 10 10
      ActionTowerDefense/Assets/Resources/Prefab/Enemy/Enemy_11001.prefab
  8. 3 14
      ActionTowerDefense/Assets/Scenes/Game.unity
  9. 37 36
      ActionTowerDefense/Assets/Scripts/Character.cs
  10. 2 2
      ActionTowerDefense/Assets/Scripts/CharacterColliders.cs
  11. 19 19
      ActionTowerDefense/Assets/Scripts/Demonic.cs
  12. 35 28
      ActionTowerDefense/Assets/Scripts/Enemy.cs
  13. 147 254
      ActionTowerDefense/Assets/Scripts/EnemyCreater.cs
  14. 3 2
      ActionTowerDefense/Assets/Scripts/EnemyTower.cs
  15. 1 1
      ActionTowerDefense/Assets/Scripts/GameManager.cs
  16. 4 4
      ActionTowerDefense/Assets/Scripts/Levels/LevelSelect.cs
  17. 7 7
      ActionTowerDefense/Assets/Scripts/PlayerController.cs
  18. 53 53
      ActionTowerDefense/Assets/Scripts/Portal/PortalsCreater.cs
  19. 2 2
      ActionTowerDefense/Assets/Scripts/Spirits/DashEffect.cs
  20. 1 1
      ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Cook.cs
  21. 2 2
      ActionTowerDefense/Assets/Scripts/Spirits/Trans_Assassin.cs
  22. 4 5
      ActionTowerDefense/Assets/Scripts/Tower.cs
  23. 2 2
      ActionTowerDefense/Assets/Scripts/Util.cs
  24. 二進制
      ActionTowerDefense/Luban/Config/Datas/~$出怪表.xlsx
  25. 二進制
      ActionTowerDefense/Luban/Config/Datas/~$怪物表.xlsx

+ 6 - 24
ActionTowerDefense/Assets/Animations/Enemy_Sword/EnemySwordCollider_Attack1.anim

@@ -7,7 +7,7 @@ AnimationClip:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_Name: EnemySwordCollider_Attack1
-  serializedVersion: 6
+  serializedVersion: 7
   m_Legacy: 0
   m_Compressed: 0
   m_UseHighQualityCurve: 1
@@ -30,7 +30,7 @@ AnimationClip:
         inWeight: 0
         outWeight: 0
       - serializedVersion: 3
-        time: 0.5
+        time: 1.05
         value: 1
         inSlope: Infinity
         outSlope: Infinity
@@ -39,16 +39,7 @@ AnimationClip:
         inWeight: 0
         outWeight: 0
       - serializedVersion: 3
-        time: 0.6666667
-        value: 1
-        inSlope: Infinity
-        outSlope: Infinity
-        tangentMode: 103
-        weightedMode: 0
-        inWeight: 0
-        outWeight: 0
-      - serializedVersion: 3
-        time: 1
+        time: 1.1166667
         value: 0
         inSlope: Infinity
         outSlope: Infinity
@@ -84,7 +75,7 @@ AnimationClip:
     m_AdditiveReferencePoseClip: {fileID: 0}
     m_AdditiveReferencePoseTime: 0
     m_StartTime: 0
-    m_StopTime: 1
+    m_StopTime: 1.1166667
     m_OrientationOffsetY: 0
     m_Level: 0
     m_CycleOffset: 0
@@ -113,16 +104,7 @@ AnimationClip:
         inWeight: 0
         outWeight: 0
       - serializedVersion: 3
-        time: 0.5
-        value: 1
-        inSlope: Infinity
-        outSlope: Infinity
-        tangentMode: 103
-        weightedMode: 0
-        inWeight: 0
-        outWeight: 0
-      - serializedVersion: 3
-        time: 0.6666667
+        time: 1.05
         value: 1
         inSlope: Infinity
         outSlope: Infinity
@@ -131,7 +113,7 @@ AnimationClip:
         inWeight: 0
         outWeight: 0
       - serializedVersion: 3
-        time: 1
+        time: 1.1166667
         value: 0
         inSlope: Infinity
         outSlope: Infinity

+ 7 - 7
ActionTowerDefense/Assets/Animations/Enemy_Sword/EnemySwordCollider_Attack2.anim

@@ -30,7 +30,7 @@ AnimationClip:
         inWeight: 0
         outWeight: 0
       - serializedVersion: 3
-        time: 0.8333333
+        time: 1.05
         value: 1
         inSlope: Infinity
         outSlope: Infinity
@@ -39,8 +39,8 @@ AnimationClip:
         inWeight: 0
         outWeight: 0
       - serializedVersion: 3
-        time: 1
-        value: 1
+        time: 1.1166667
+        value: 0
         inSlope: Infinity
         outSlope: Infinity
         tangentMode: 103
@@ -75,7 +75,7 @@ AnimationClip:
     m_AdditiveReferencePoseClip: {fileID: 0}
     m_AdditiveReferencePoseTime: 0
     m_StartTime: 0
-    m_StopTime: 1
+    m_StopTime: 1.1166667
     m_OrientationOffsetY: 0
     m_Level: 0
     m_CycleOffset: 0
@@ -104,7 +104,7 @@ AnimationClip:
         inWeight: 0
         outWeight: 0
       - serializedVersion: 3
-        time: 0.8333333
+        time: 1.05
         value: 1
         inSlope: Infinity
         outSlope: Infinity
@@ -113,8 +113,8 @@ AnimationClip:
         inWeight: 0
         outWeight: 0
       - serializedVersion: 3
-        time: 1
-        value: 1
+        time: 1.1166667
+        value: 0
         inSlope: Infinity
         outSlope: Infinity
         tangentMode: 103

+ 14 - 2
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/GameMapTile.cs

@@ -10,6 +10,16 @@ public struct SpawnTime
 	public int num;
 }
 
+[Serializable]
+public struct Parameter
+{
+	public int HP;
+	public float MinMoveSpeed;
+	public float MaxMoveSpeed;
+	public int Attack_summon;
+	public int Attack_march;
+}
+
 
 /// <summary> A tile definition. The map/grid consist of an array of these tiles. </summary>
 [System.Serializable]
@@ -36,9 +46,9 @@ public class GameMapTile
 	//	(of course the demo script makes use of them so update it too)
 	//	Remember to add/remove fields to CopyTo() function too
 
-	public enum Type { Null = 0,  Tower=1, EnemyTower=2, Enemy=3 }
+	public enum Type { Null = 0,  Tower=1, Enemy=2}
 	public Type type = Type.Null;   // the runtime might use something like this to identify what the placed tile means
-	public enum CH { arrow = 0, kongfu = 1, shield = 2};            // this value could depend on the chosen type. For example, if NPC then this could indicate which NPC prefab to spawn from an array of NPC prefabs.
+	public enum CH {Tower=0, EnemyTower = 1, Enemy_Arrow = 2, Enemy_Giant = 3, Enemy_Sword = 4};            // this value could depend on the chosen type. For example, if NPC then this could indicate which NPC prefab to spawn from an array of NPC prefabs.
 	public CH ch;
 
 	[GameMapTilePreview] public Color color = Color.white;
@@ -47,6 +57,8 @@ public class GameMapTile
 	public SpawnTime[] spawnTime;
 	[HideInInspector]public int index = -1;
 	[HideInInspector]public bool hasOut = false;
+	public Parameter parameter;
+	
 
 	// ----------------------------------------------------------------------------------------------------------------
 

+ 0 - 5
ActionTowerDefense/Assets/GameLevelEditor/GameMap/Sample/Scripts/Main.cs

@@ -159,11 +159,6 @@ public class Main : MonoBehaviour
 							ren.transform.SetParent(TowerContainer, false);
 							ren.transform.localScale = new Vector3(tileSize / ren.sprite.rect.width * 2, tileSize / ren.sprite.rect.height * 9, 1f);
 							break;
-						case GameMapTile.Type.EnemyTower:
-							ren = Instantiate(enemyTowerFab[(int)t.ch]).GetComponentInChildren<SpriteRenderer>();
-							ren.transform.SetParent(EnemyTowerContainer, false);
-							ren.transform.localScale = new Vector3(tileSize / ren.sprite.rect.width * 2, tileSize / ren.sprite.rect.height * 9, 1f);
-							break;
 						case GameMapTile.Type.Enemy:
 							ren = Instantiate(enemyFabs[(int)t.ch]).GetComponentInChildren<SpriteRenderer>();
 							ren.transform.SetParent(EnemyContainer, false);

+ 148 - 19
ActionTowerDefense/Assets/GameLevelEditor/tiles.asset

@@ -23,23 +23,35 @@ MonoBehaviour:
     name: "\u9632\u5FA1\u5854"
     spawnTime: []
     index: -1
-    hasOut: 0
+    hasOut: 1
+    parameter:
+      HP: 0
+      MinMoveSpeed: 0
+      MaxMoveSpeed: 0
+      Attack1: 0
+      Attack2: 0
   - id: 166
     sprite: {fileID: 21300000, guid: c7c064310e92d5444a7493e15f8b4762, type: 3}
     _aid: -1
-    type: 2
+    type: 1
     ch: 0
     color: {r: 1, g: 0, b: 0, a: 0.39215687}
     radius: {x: 0, y: 0}
     name: "\u654C\u65B9\u9632\u5FA1\u5854"
     spawnTime: []
     index: -1
-    hasOut: 0
+    hasOut: 1
+    parameter:
+      HP: 0
+      MinMoveSpeed: 0
+      MaxMoveSpeed: 0
+      Attack1: 0
+      Attack2: 0
   - id: 163
     sprite: {fileID: 21300000, guid: 01c1ca6a4fe22a94b91a3b2b90b5c88f, type: 3}
     _aid: -1
-    type: 3
-    ch: 0
+    type: 2
+    ch: 2
     color: {r: 1, g: 1, b: 1, a: 1}
     radius: {x: 1, y: 1}
     name: "\u5F13\u7BAD\u624B1"
@@ -48,43 +60,64 @@ MonoBehaviour:
       endTime: 5
       num: 2
     index: -1
-    hasOut: 0
+    hasOut: 1
+    parameter:
+      HP: 100
+      MinMoveSpeed: 1
+      MaxMoveSpeed: 1
+      Attack1: 1
+      Attack2: 1
   - id: 164
     sprite: {fileID: 21300000, guid: 43f59a03605a34d4abed7ed387066287, type: 3}
     _aid: -1
-    type: 3
-    ch: 0
+    type: 2
+    ch: 4
     color: {r: 1, g: 1, b: 1, a: 1}
     radius: {x: 1, y: 2}
     name: "\u6B66\u672F\u5BB6"
     spawnTime: []
     index: -1
-    hasOut: 0
+    hasOut: 1
+    parameter:
+      HP: 0
+      MinMoveSpeed: 0
+      MaxMoveSpeed: 0
+      Attack1: 0
+      Attack2: 0
   - id: 165
     sprite: {fileID: 21300000, guid: b371758afaed0994e9076c34d8dbac5f, type: 3}
     _aid: -1
-    type: 3
-    ch: 0
+    type: 2
+    ch: 3
     color: {r: 1, g: 1, b: 1, a: 1}
     radius: {x: 2, y: 1}
     name: "\u80D6\u5B50"
     spawnTime: []
     index: -1
-    hasOut: 0
+    hasOut: 1
+    parameter:
+      HP: 0
+      MinMoveSpeed: 0
+      MaxMoveSpeed: 0
+      Attack1: 0
+      Attack2: 0
   - id: 168
     sprite: {fileID: 21300000, guid: 01c1ca6a4fe22a94b91a3b2b90b5c88f, type: 3}
     _aid: -1
-    type: 3
-    ch: 0
+    type: 2
+    ch: 2
     color: {r: 0.1495924, g: 1, b: 0, a: 1}
     radius: {x: 2, y: 2}
     name: "\u5F13\u7BAD\u624B2"
-    spawnTime:
-    - startTime: 2
-      endTime: 3
-      num: 5
+    spawnTime: []
     index: -1
-    hasOut: 0
+    hasOut: 1
+    parameter:
+      HP: 0
+      MinMoveSpeed: 0
+      MaxMoveSpeed: 0
+      Attack1: 0
+      Attack2: 0
   autoTiles:
   - id: 1
     tiles:
@@ -99,6 +132,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 32
       sprite: {fileID: 21300086, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -110,6 +149,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 33
       sprite: {fileID: 21300092, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -121,6 +166,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 34
       sprite: {fileID: 21300084, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -132,6 +183,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 35
       sprite: {fileID: 21300088, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -143,6 +200,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 36
       sprite: {fileID: 21300008, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -154,6 +217,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 37
       sprite: {fileID: 21300090, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -165,6 +234,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 38
       sprite: {fileID: 21300010, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -176,6 +251,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 39
       sprite: {fileID: 21300004, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -187,6 +268,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 40
       sprite: {fileID: 21300082, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -198,6 +285,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 41
       sprite: {fileID: 21300076, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -209,6 +302,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 42
       sprite: {fileID: 21300080, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -220,6 +319,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 43
       sprite: {fileID: 21300000, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -231,6 +336,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 44
       sprite: {fileID: 21300078, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -242,6 +353,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 45
       sprite: {fileID: 21300002, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -253,6 +370,12 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
     - id: 46
       sprite: {fileID: 21300006, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
       _aid: 1
@@ -264,5 +387,11 @@ MonoBehaviour:
       spawnTime: []
       index: 0
       hasOut: 0
+      parameter:
+        HP: 0
+        MinMoveSpeed: 0
+        MaxMoveSpeed: 0
+        Attack1: 0
+        Attack2: 0
   nextTileId: 169
   nextAutoTileId: 7

+ 11 - 11
ActionTowerDefense/Assets/Gen/SingleEnemyConfig.cs

@@ -21,20 +21,20 @@ public sealed partial class SingleEnemyConfig :  Bright.Config.BeanBase
         { if(!_json["ID"].IsNumber) { throw new SerializationException(); }  ID = _json["ID"]; }
         { if(!_json["EnemyPrefab"].IsString) { throw new SerializationException(); }  EnemyPrefab = _json["EnemyPrefab"]; }
         { if(!_json["HP"].IsNumber) { throw new SerializationException(); }  HP = _json["HP"]; }
-        { var __json0 = _json["Attack1"]; if(!__json0.IsArray) { throw new SerializationException(); } Attack1 = new System.Collections.Generic.List<int>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { int __v0;  { if(!__e0.IsNumber) { throw new SerializationException(); }  __v0 = __e0; }  Attack1.Add(__v0); }   }
-        { var __json0 = _json["Attack2"]; if(!__json0.IsArray) { throw new SerializationException(); } Attack2 = new System.Collections.Generic.List<int>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { int __v0;  { if(!__e0.IsNumber) { throw new SerializationException(); }  __v0 = __e0; }  Attack2.Add(__v0); }   }
+        { var __json0 = _json["Attack_summon"]; if(!__json0.IsArray) { throw new SerializationException(); } Attack_summon = new System.Collections.Generic.List<int>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { int __v0;  { if(!__e0.IsNumber) { throw new SerializationException(); }  __v0 = __e0; }  Attack_summon.Add(__v0); }   }
+        { var __json0 = _json["Attack_march"]; if(!__json0.IsArray) { throw new SerializationException(); } Attack_march = new System.Collections.Generic.List<int>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { int __v0;  { if(!__e0.IsNumber) { throw new SerializationException(); }  __v0 = __e0; }  Attack_march.Add(__v0); }   }
         { if(!_json["MinMoveSpeed"].IsNumber) { throw new SerializationException(); }  MinMoveSpeed = _json["MinMoveSpeed"]; }
         { if(!_json["MaxMoveSpeed"].IsNumber) { throw new SerializationException(); }  MaxMoveSpeed = _json["MaxMoveSpeed"]; }
         PostInit();
     }
 
-    public SingleEnemyConfig(int ID, string EnemyPrefab, int HP, System.Collections.Generic.List<int> Attack1, System.Collections.Generic.List<int> Attack2, float MinMoveSpeed, float MaxMoveSpeed ) 
+    public SingleEnemyConfig(int ID, string EnemyPrefab, int HP, System.Collections.Generic.List<int> Attack_summon, System.Collections.Generic.List<int> Attack_march, float MinMoveSpeed, float MaxMoveSpeed ) 
     {
         this.ID = ID;
         this.EnemyPrefab = EnemyPrefab;
         this.HP = HP;
-        this.Attack1 = Attack1;
-        this.Attack2 = Attack2;
+        this.Attack_summon = Attack_summon;
+        this.Attack_march = Attack_march;
         this.MinMoveSpeed = MinMoveSpeed;
         this.MaxMoveSpeed = MaxMoveSpeed;
         PostInit();
@@ -58,13 +58,13 @@ public sealed partial class SingleEnemyConfig :  Bright.Config.BeanBase
     /// </summary>
     public int HP { get; private set; }
     /// <summary>
-    /// Attack1攻击力
+    /// Attack_summon攻击力
     /// </summary>
-    public System.Collections.Generic.List<int> Attack1 { get; private set; }
+    public System.Collections.Generic.List<int> Attack_summon { get; private set; }
     /// <summary>
-    /// Attack2攻击力
+    /// Attack_march攻击力
     /// </summary>
-    public System.Collections.Generic.List<int> Attack2 { get; private set; }
+    public System.Collections.Generic.List<int> Attack_march { get; private set; }
     /// <summary>
     /// 最小移动速度
     /// </summary>
@@ -92,8 +92,8 @@ public sealed partial class SingleEnemyConfig :  Bright.Config.BeanBase
         + "ID:" + ID + ","
         + "EnemyPrefab:" + EnemyPrefab + ","
         + "HP:" + HP + ","
-        + "Attack1:" + Bright.Common.StringUtil.CollectionToString(Attack1) + ","
-        + "Attack2:" + Bright.Common.StringUtil.CollectionToString(Attack2) + ","
+        + "Attack_summon:" + Bright.Common.StringUtil.CollectionToString(Attack_summon) + ","
+        + "Attack_march:" + Bright.Common.StringUtil.CollectionToString(Attack_march) + ","
         + "MinMoveSpeed:" + MinMoveSpeed + ","
         + "MaxMoveSpeed:" + MaxMoveSpeed + ","
         + "}";

+ 10 - 10
ActionTowerDefense/Assets/Resources/Prefab/Enemy/Enemy_11001.prefab

@@ -151,8 +151,8 @@ BoxCollider:
   m_IsTrigger: 1
   m_Enabled: 1
   serializedVersion: 2
-  m_Size: {x: 2.77, y: 1.88, z: 2}
-  m_Center: {x: -1.5, y: 0.95, z: 0}
+  m_Size: {x: 1.3459527, y: 1.3988962, z: 2}
+  m_Center: {x: -0.62717974, y: 0.7094481, z: 0}
 --- !u!114 &2280520615464243483
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -464,8 +464,8 @@ BoxCollider:
   m_IsTrigger: 1
   m_Enabled: 1
   serializedVersion: 2
-  m_Size: {x: 0.38, y: 0.03, z: 2}
-  m_Center: {x: 0, y: 0, z: 0}
+  m_Size: {x: 0.73469824, y: 0.080095746, z: 2}
+  m_Center: {x: -0.09411308, y: 0.025047857, z: 0}
 --- !u!114 &2437299196663985756
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -696,8 +696,8 @@ BoxCollider:
   m_IsTrigger: 1
   m_Enabled: 1
   serializedVersion: 2
-  m_Size: {x: 0.49, y: 1.64, z: 2}
-  m_Center: {x: 0, y: 0.792, z: 0}
+  m_Size: {x: 0.8995418, y: 1.64, z: 2}
+  m_Center: {x: -0.26193073, y: 0.792, z: 0}
 --- !u!114 &6427563181875878110
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -739,7 +739,7 @@ Transform:
   m_GameObject: {fileID: 6164447163453378808}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 1, y: 0.8, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 2437299196472462364}
@@ -967,7 +967,7 @@ Transform:
   m_GameObject: {fileID: 7669620205589286043}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 0.36, y: 0.36, z: 1}
+  m_LocalScale: {x: 0.5, y: 0.5, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 5075820377452290163}
@@ -1130,5 +1130,5 @@ BoxCollider:
   m_IsTrigger: 0
   m_Enabled: 1
   serializedVersion: 2
-  m_Size: {x: 0.58, y: 1.59, z: 2}
-  m_Center: {x: 0, y: 0.792, z: 0}
+  m_Size: {x: 1.082513, y: 1.3722445, z: 2}
+  m_Center: {x: -0.25125653, y: 0.6831222, z: 0}

+ 3 - 14
ActionTowerDefense/Assets/Scenes/Game.unity

@@ -19765,12 +19765,9 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 0b88ebc6e4d3df6439f5464df5614ec5, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  createdEnemy: 
-  createEnemyTime: []
-  createdBuilding: 
-  createBuildingTime: []
-  portalsCreateTime: 10
-  portalUIParent: {fileID: 1512487595}
+  createCharacter: []
+  mapsAsset: {fileID: 11400000, guid: bbf7388a54f14f842b7aecb67d709046, type: 2}
+  levelSelect: {fileID: 1714821088}
 --- !u!114 &1714821088
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -19787,17 +19784,9 @@ MonoBehaviour:
   curLevelID: 2
   levelConfig:
   - levelName: Level_Normal_A_000_000
-    enemyExcelID: 1
-    buildingExcelID: 1
   - levelName: Level_Normal_A_000_001
-    enemyExcelID: 2
-    buildingExcelID: 3
   - levelName: Level_Normal_A_000_002
-    enemyExcelID: 3
-    buildingExcelID: 4
   - levelName: "Level_Normal_A_000_003\u5B88\u5854"
-    enemyExcelID: 2
-    buildingExcelID: 2
 --- !u!1 &1729202001
 GameObject:
   m_ObjectHideFlags: 0

+ 37 - 36
ActionTowerDefense/Assets/Scripts/Character.cs

@@ -106,20 +106,20 @@ public class Character : MonoBehaviour
     [HideInInspector]
     public bool isNonAttack = false;            //无普攻
     public float attackTime;
-    public float totalAttack1Time = 0.5f;
-    public float totalAttack2Time = 0.5f;
+    public float totalAttack_summonTime = 0.5f;
+    public float totalAttack_marchTime = 0.5f;
     public AttackType attackType;               //攻击类型
     public GameObject bulletPrefab;             //远程攻击的子弹
     public List<Transform> shootPos;            //远程攻击的子弹发射位置
     public bool shootTrack = false;             //远程攻击是否追踪目标
-    public List<AttackInfo> attack1Infos;       //普攻1信息(出场攻击)
-    public List<AttackInfo> attack2Infos;       //普攻2信息
+    public List<AttackInfo> Attack_summonInfos;       //普攻1信息(出场攻击)
+    public List<AttackInfo> Attack_marchInfos;       //普攻2信息
     public List<AttackTrigger> attackTriggers;  //普攻触发器,敌方进入后播放动画进行攻击
     public GameObject addAttackEffect;
     public int armorPiercing;                   //穿甲率
     public int[] curDamage1;
     public int[] curDamage2;
-     
+
     [Header("目标")]
     public List<TargetType> targetTypes;
     public Character targetCharacter;
@@ -149,7 +149,7 @@ public class Character : MonoBehaviour
     public GameObject cookEffect;       //吃串加血
 
     [Header("传送门")]
-    public bool attack1ShootCanTransmit;    //普攻1弓箭可以被传送
+    public bool Attack_summonShootCanTransmit;    //普攻1弓箭可以被传送
 
     //调试开关
     [Header("debug攻击者")] public bool debugAttackFrom;
@@ -192,15 +192,15 @@ public class Character : MonoBehaviour
         {
             rope = null;
         }
-        curDamage1 = new int[attack1Infos.Count];
-        for (int i = 0; i < attack1Infos.Count; i++)
+        curDamage1 = new int[Attack_summonInfos.Count];
+        for (int i = 0; i < Attack_summonInfos.Count; i++)
         {
-            curDamage1[i] = attack1Infos[i].damage;
+            curDamage1[i] = Attack_summonInfos[i].damage;
         }
-        curDamage2 = new int[attack2Infos.Count];
-        for (int i = 0; i < attack2Infos.Count; i++)
+        curDamage2 = new int[Attack_marchInfos.Count];
+        for (int i = 0; i < Attack_marchInfos.Count; i++)
         {
-            curDamage2[i] = attack2Infos[i].damage;
+            curDamage2[i] = Attack_marchInfos[i].damage;
         }
     }
 
@@ -265,7 +265,7 @@ public class Character : MonoBehaviour
         uiHp.Show(hp, totalHp);
         if (hp <= 0)
         {
-            if(!canNotAddForce)
+            if (!canNotAddForce)
                 rb.AddForce(force);
             ChangeState(CharacterState.Die);
             return;
@@ -277,11 +277,11 @@ public class Character : MonoBehaviour
         AttackInfo attackInfo;
         if (attackId == 1)
         {
-            attackInfo = attack1Infos[shootId];
+            attackInfo = Attack_summonInfos[shootId];
         }
         else
         {
-            attackInfo = attack2Infos[shootId];
+            attackInfo = Attack_marchInfos[shootId];
             attackInfo.damage = curDamage2[0];
         }
         GameObject bulletObj = PoolManager.Instantiate(bulletPrefab);
@@ -291,7 +291,7 @@ public class Character : MonoBehaviour
         {
             attackDir.x = -attackDir.x;
         }
-        if (attackId == 1 && attack1ShootCanTransmit)
+        if (attackId == 1 && Attack_summonShootCanTransmit)
         {
             bullet.canTransmit = true;
         }
@@ -304,32 +304,33 @@ public class Character : MonoBehaviour
         return moveDir;
     }
 
-    public virtual void Attack1()
+    public virtual void Attack_summon()
     {
-        ani.Play("attack_summon", 0, 0);
+        ani.Play("Attack_summon", 0, 0);
         if (!isNonAttack)
         {
-            aniCollider.Play("Attack1", 1, 0);
-            attackTime = totalAttack1Time;
+            aniCollider.Play("Attack_summon", 1, 0);
+            attackTime = totalAttack_summonTime;
             switch (attackType)
             {
                 case AttackType.Melee:
-                    for (int i = 0; i < attack1Infos.Count; i++)
+                    for (int i = 0; i < Attack_summonInfos.Count; i++)
                     {
                         attackTriggers[i].damage = curDamage1[i];
-                        attackTriggers[i].changeHurt = attack1Infos[i].changeHurt;
-                        attackTriggers[i].repelValue = attack1Infos[i].repelValue;
-                        Vector3 attackDir = attack1Infos[i].attackDir.normalized;
+                        attackTriggers[i].changeHurt = Attack_summonInfos[i].changeHurt;
+                        attackTriggers[i].repelValue = Attack_summonInfos[i].repelValue;
+                        Vector3 attackDir = Attack_summonInfos[i].attackDir.normalized;
                         if (bodyTrans.localScale.x < 0)
                         {
                             attackDir.x = -attackDir.x;
                         }
-                        attackTriggers[i].force = attackDir * attack1Infos[i].force;
+                        attackTriggers[i].force = attackDir * Attack_summonInfos[i].force;
                     }
                     break;
                 case AttackType.Shoot:
                 case AttackType.Dash:
                     break;
+
                 default:
                     break;
             }
@@ -337,7 +338,7 @@ public class Character : MonoBehaviour
         }
     }
 
-    public virtual void Attack2()
+    public virtual void Attack_march()
     {
         Vector3 leftDir = GetMoveDir();
         if (leftDir.x > 0.3f)
@@ -355,23 +356,23 @@ public class Character : MonoBehaviour
             }
         }
 
-        ani.Play("attack_march", 0, 0);
-        aniCollider.Play("Attack2", 1, 0);
-        attackTime = totalAttack2Time;
-        if(attackTriggers.Count > 0)
+        ani.Play("Attack_march", 0, 0);
+        aniCollider.Play("Attack_march", 1, 0);
+        attackTime = totalAttack_marchTime;
+        if (attackTriggers.Count > 0)
         {
-            for (int i = 0; i < attack2Infos.Count; i++)
+            for (int i = 0; i < Attack_marchInfos.Count; i++)
             {
                 attackTriggers[i].damage = curDamage2[i];
-                attackTriggers[i].changeHurt = attack2Infos[i].changeHurt;
-                attackTriggers[i].repelValue = attack2Infos[i].repelValue;
-                Vector3 attackDir = attack2Infos[i].attackDir.normalized;
+                attackTriggers[i].changeHurt = Attack_marchInfos[i].changeHurt;
+                attackTriggers[i].repelValue = Attack_marchInfos[i].repelValue;
+                Vector3 attackDir = Attack_marchInfos[i].attackDir.normalized;
                 if (bodyTrans.localScale.x < 0)
                 {
                     attackDir.x = -attackDir.x;
                 }
-                attackTriggers[i].force = attackDir * attack2Infos[i].force;
-            }   
+                attackTriggers[i].force = attackDir * Attack_marchInfos[i].force;
+            }
         }
 
 

+ 2 - 2
ActionTowerDefense/Assets/Scripts/CharacterColliders.cs

@@ -18,7 +18,7 @@ public class CharacterColliders : MonoBehaviour
 
     }
 
-    public void Attack1ShootEvent(int shootId)
+    public void Attack_summonShootEvent(int shootId)
     {
         if (owner == null)
         {
@@ -27,7 +27,7 @@ public class CharacterColliders : MonoBehaviour
         owner.AttackShootEvent(1, shootId);
     }
 
-    public void Attack2ShootEvent(int shootId)
+    public void Attack_marchShootEvent(int shootId)
     {
         if (smoke != null && smoke.activeSelf)
         {

+ 19 - 19
ActionTowerDefense/Assets/Scripts/Demonic.cs

@@ -35,7 +35,7 @@ public class Demonic : MoveCharacter
 
     [Header("八卦")]
     public float adsorbSpeed;                           //八卦吸附的速度
-    [HideInInspector]public Vector3 adsorbTarget;       //八卦胖子吸附时目标位置的X
+    [HideInInspector] public Vector3 adsorbTarget;       //八卦胖子吸附时目标位置的X
     private float adsorbTime;                           //八卦吸附中的时间
     public GameObject effectPrefab;                     //八卦卦象效果
 
@@ -169,7 +169,7 @@ public class Demonic : MoveCharacter
                 switch (searchState)
                 {
                     case SearchState.NoTarget:
-                        if(TowerMap.enemyTowers.Count == 0)
+                        if (TowerMap.enemyTowers.Count == 0)
                         {
                             moveDir = Vector3.left;
                             break;
@@ -179,7 +179,7 @@ public class Demonic : MoveCharacter
                         for (int i = 0; i < TowerMap.enemyTowers.Count; i++)
                         {
                             EnemyTower enemyTower = TowerMap.enemyTowers[i].GetComponent<EnemyTower>();
-                            if(transform.position.y > 
+                            if (transform.position.y >
                                 enemyTower.transform.position.y + enemyTower.height)
                             {
                                 continue;
@@ -192,7 +192,7 @@ public class Demonic : MoveCharacter
                                 id = i;
                             }
                         }
-                        if(id == -1)
+                        if (id == -1)
                         {
                             moveDir = Vector3.left;
                             break;
@@ -304,13 +304,13 @@ public class Demonic : MoveCharacter
         beRepelValue += Time.deltaTime;
         Vector3 leftDir = GetMoveDir();
         bool isAttack = GetAttack();
-        
+
         switch (state)
         {
             case CharacterState.Idle:
                 if (isAttack)
                 {
-                    Attack2();
+                    Attack_march();
                     break;
                 }
                 if (!foot.TrigGround && !canFly)
@@ -331,7 +331,7 @@ public class Demonic : MoveCharacter
                     ChangeState(CharacterState.Run);
                     break;
                 }
-                
+
                 if (!upFirstAfterWeaknessOrNot)
                 {
                     if (canFly)
@@ -346,7 +346,7 @@ public class Demonic : MoveCharacter
             case CharacterState.Run:
                 if (isAttack)
                 {
-                    Attack2();
+                    Attack_march();
                     break;
                 }
                 if (!foot.TrigGround && !canFly)
@@ -383,7 +383,7 @@ public class Demonic : MoveCharacter
                 else if (leftDir.x < -0.3f)
                 {
                     //rb.velocity -= Vector3.right * moveAcc * Time.deltaTime;
-                    rb.velocity = Vector3.right *( -moveSpeed + velocityAddition);
+                    rb.velocity = Vector3.right * (-moveSpeed + velocityAddition);
                     //if (rb.velocity.x < -maxMoveSpeed)
                     //{
                     //    rb.velocity = new Vector3(-maxMoveSpeed, rb.velocity.y, rb.velocity.z);
@@ -406,7 +406,7 @@ public class Demonic : MoveCharacter
             case CharacterState.Rush:
                 if (isAttack)
                 {
-                    Attack2();
+                    Attack_march();
                     break;
                 }
                 if (!foot.TrigGround && !canFly)
@@ -520,7 +520,7 @@ public class Demonic : MoveCharacter
                     }
                     break;
                 }
-                rb.velocity = new Vector3(velocityAddition,rb.velocity.y,rb.velocity.z);
+                rb.velocity = new Vector3(velocityAddition, rb.velocity.y, rb.velocity.z);
                 break;
             case CharacterState.Die:
                 if (dieKeepTime <= 0)
@@ -677,7 +677,7 @@ public class Demonic : MoveCharacter
     {
         float dis = 1000000;
         GameObject to = null;
-        foreach(GameObject g in TowerMap.enemyTowers)
+        foreach (GameObject g in TowerMap.enemyTowers)
         {
             float k = Vector3.Distance(g.transform.position, transform.position);
             if (k < dis)
@@ -704,7 +704,7 @@ public class Demonic : MoveCharacter
 
     public override void ChangeState(CharacterState newState)
     {
-        if(state == newState || state == CharacterState.BaGua)
+        if (state == newState || state == CharacterState.BaGua)
         {
             return;
         }
@@ -723,7 +723,7 @@ public class Demonic : MoveCharacter
                 {
                     bodyCollider.SetActive(true);
                 }
-                
+
                 break;
             case CharacterState.Fall:
                 rb.velocity = Vector3.zero;
@@ -837,9 +837,9 @@ public class Demonic : MoveCharacter
         }
     }
 
-    public override void Attack1()
+    public override void Attack_summon()
     {
-        base.Attack1();
+        base.Attack_summon();
         Vector3 moveDir;
         if (PlayersInput.instance[playerID].bodyTrans.localScale.x > 0)
         {
@@ -863,13 +863,13 @@ public class Demonic : MoveCharacter
                 Turn();
             }
         }
-        invincibleTime = totalAttack1Time;
+        invincibleTime = totalAttack_summonTime;
         attackTarget = targetCharacter;
     }
 
-    public override void Attack2()
+    public override void Attack_march()
     {
-        base.Attack2();
+        base.Attack_march();
         attackTarget = targetCharacter;
     }
 

+ 35 - 28
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -116,6 +116,11 @@ public class Enemy : MoveCharacter
         }
     }
 
+    private void OnEnable()
+    {
+        Init();
+    }
+
     public void OnDisable()
     {
         EnemyCreater.instance.OnEnemyRecycle(this);
@@ -125,6 +130,7 @@ public class Enemy : MoveCharacter
     {
         base.Init();
         moveSpeed = Random.Range(minMoveSpeed, maxMoveSpeed);
+
         ChangeSearchState(SearchState.NoTarget);
     }
 
@@ -161,7 +167,7 @@ public class Enemy : MoveCharacter
                         {
                             continue;
                         }
-                        float distance = Vector3.Distance(transform.position, 
+                        float distance = Vector3.Distance(transform.position,
                             TowerMap.myTowers[i].transform.position);
                         if (distance < minDistance)
                         {
@@ -182,7 +188,7 @@ public class Enemy : MoveCharacter
                     {
                         moveDir = Vector3.right;
                     }
-                    
+
                     break;
                 case SearchState.InSearchScope:
                     if (targetCharacter)
@@ -282,7 +288,7 @@ public class Enemy : MoveCharacter
             case CharacterState.Idle:
                 if (isAttack)
                 {
-                    Attack2();
+                    Attack_march();
                     break;
                 }
                 if (!foot.TrigGround && !canFly)
@@ -313,12 +319,12 @@ public class Enemy : MoveCharacter
                         AdjustHeight();
                     }
                 }
-                
+
                 break;
             case CharacterState.Run:
                 if (isAttack)
                 {
-                    Attack2();
+                    Attack_march();
                     break;
                 }
                 if (!foot.TrigGround && !canFly)
@@ -363,12 +369,13 @@ public class Enemy : MoveCharacter
                         rb.useGravity = false;
                         AdjustHeight();
                     }
+
                 }
                 break;
             case CharacterState.Rush:
                 if (isAttack)
                 {
-                    Attack2();
+                    Attack_march();
                     break;
                 }
                 if (!foot.TrigGround && !canFly)
@@ -479,13 +486,13 @@ public class Enemy : MoveCharacter
                 }
                 break;
             case CharacterState.Weak:
-                if(rb.velocity.magnitude > 1)
+                if (rb.velocity.magnitude > 1)
                 {
-                    if(!isBeBlownUp)
+                    if (!isBeBlownUp)
                     {
                         isBeBlownUp = true;
-                        ani.Play("hitted",0,0);
-                        aniCollider.Play("Hurt",0,0);
+                        ani.Play("hitted", 0, 0);
+                        aniCollider.Play("Hurt", 0, 0);
                     }
                     Vector3 vel = rb.velocity;
                     if (foot.TrigGround && vel.y <= 0)
@@ -590,10 +597,10 @@ public class Enemy : MoveCharacter
                             break;
                         }
                     }
-                    if(targetCharacter == null)
+                    if (targetCharacter == null)
                     {
                         ChosePlayer();
-                        if(targetCharacter == null)
+                        if (targetCharacter == null)
                         {
                             ChangeState(CharacterState.FinishRush);
                             time = finishRushTime;
@@ -609,7 +616,7 @@ public class Enemy : MoveCharacter
                             break;
                         }
                     }
-                    if (Mathf.Abs(transform.position.x-targetCharacter.transform.position.x)
+                    if (Mathf.Abs(transform.position.x - targetCharacter.transform.position.x)
                         < hateDistance)
                     {
                         rushEndPos = targetCharacter.transform.position;
@@ -685,7 +692,7 @@ public class Enemy : MoveCharacter
                 }
                 break;
             case CharacterState.DownRush:
-                
+
                 if (transform.position.y > 0)
                 {
                     dashEffect.canHit = true;
@@ -810,7 +817,7 @@ public class Enemy : MoveCharacter
                 break;
             case CharacterState.FinishRush:
                 time = 0;
-                
+
                 searchState = SearchState.NoTarget;
                 noOnSearchState = false;
                 ani.Play("idle", 0, 0);
@@ -896,7 +903,7 @@ public class Enemy : MoveCharacter
                             rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
                             rb.useGravity = true;
                         }
-                        
+
                         //hurtKeepTime = minHurtKeepTime;
                         break;
                 }
@@ -916,10 +923,10 @@ public class Enemy : MoveCharacter
                 aimEffect.SetActive(true);
                 rb.constraints = RigidbodyConstraints.FreezeAll;
                 ReadyToDash(rushEndPos + Vector3.up, transform.position + Vector3.up);
-                
+
                 break;
             case CharacterState.RushAttack:
-                
+
                 targetDir =
                         (rushEndPos - transform.position).normalized;
                 ani.Play("rush_attack", 0, 0);
@@ -954,7 +961,7 @@ public class Enemy : MoveCharacter
 
     public void DropSouls()
     {
-        int dropSoulNum = Random.Range(dropSoulMin, dropSoulMax+1);
+        int dropSoulNum = Random.Range(dropSoulMin, dropSoulMax + 1);
         if (dropSoulNum > 1)
         {
             for (int i = 0; i < dropSoulNum; i++)
@@ -1117,15 +1124,15 @@ public class Enemy : MoveCharacter
         }
     }
 
-    public override void Attack1()
+    public override void Attack_summon()
     {
-        base.Attack1();
+        base.Attack_summon();
         attackTarget = targetCharacter;
     }
 
-    public override void Attack2()
+    public override void Attack_march()
     {
-        base.Attack2();
+        base.Attack_march();
         attackTarget = targetCharacter;
     }
     public void ChosePlayer()
@@ -1134,17 +1141,17 @@ public class Enemy : MoveCharacter
         float distance1 = Mathf.Infinity;
         PlayerController player0 = PlayersInput.instance[0];
         PlayerController player1 = PlayersInput.instance[1];
-        if (player0!=null && !player0.isRevive && !player0.isBaseBtnOut)
+        if (player0 != null && !player0.isRevive && !player0.isBaseBtnOut)
         {
             distance0 = Mathf.Abs(player0.transform.position.x
                 - transform.position.x);
         }
-        if (player1!=null && !player1.isRevive && !player1.isBaseBtnOut)
+        if (player1 != null && !player1.isRevive && !player1.isBaseBtnOut)
         {
             distance1 = Mathf.Abs(player1.transform.position.x
                 - transform.position.x);
         }
-        if(distance0 == Mathf.Infinity && distance1 == Mathf.Infinity)
+        if (distance0 == Mathf.Infinity && distance1 == Mathf.Infinity)
         {
             targetCharacter = null;
             return;
@@ -1156,7 +1163,7 @@ public class Enemy : MoveCharacter
             {
                 player0.beTargetCharacter.Add(this);
             }
-            
+
             distance = distance0;
 
         }
@@ -1167,7 +1174,7 @@ public class Enemy : MoveCharacter
             {
                 player1.beTargetCharacter.Add(this);
             }
-                
+
             distance = distance1;
         }
     }

+ 147 - 254
ActionTowerDefense/Assets/Scripts/EnemyCreater.cs

@@ -5,23 +5,30 @@ using cfg;
 using System.Threading.Tasks;
 using Base.Common;
 using System.Linq;
+using System;
+
+[Serializable]
+public struct CreaterControl
+{
+    public bool isCreated;
+    public GameMapTile tile;
+    public int spawnTimeId;
+    public Vector3 pos;
+}
+
 
 public class EnemyCreater : MonoBehaviour
 {
     public static EnemyCreater instance;
-    [SerializeField]public List<SingleCreateEnemyConfig> cfgCreateEnemy;
-    public List<SingleCreateBuildingConfig> cfgCreateBuilding;
-    public List<bool> createdEnemy;
-    public List<float> createEnemyTime;
-    public List<bool> createdBuilding;
-    public List<float> createBuildingTime;
+    public List<CreaterControl> createCharacter = new();
     public Dictionary<int, List<Enemy>> enemyDic;
-    public Dictionary<int, GameObject> buildingDic;
+    public Dictionary<int, List<GameObject>> buildingDic;
     private LevelSelect.Level curLevel;
+    public GameMapsAsset mapsAsset;
+
+    //import
+    public LevelSelect levelSelect;
 
-    [Header("传送门")]
-    public float portalsCreateTime = 10;           //传送门提前出现时间
-    public Transform portalUIParent;               //传送门出现提示UI的父物体
 
     private void Awake()
     {
@@ -35,145 +42,70 @@ public class EnemyCreater : MonoBehaviour
             return;
         }
         enemyDic = new Dictionary<int, List<Enemy>>();
-        buildingDic = new Dictionary<int, GameObject>();
+        buildingDic = new Dictionary<int, List<GameObject>>();
     }
 
     private void Start()
     {
-        curLevel = GetComponent<LevelSelect>().levelConfig[GetComponent<LevelSelect>().curLevelID - 1];
-        cfgCreateEnemy = GameManager.instance.allCfgData.CfgCreateEnemy.DataList;
-        cfgCreateBuilding = GameManager.instance.allCfgData.CfgCreateBuilding.DataList;
-        createdEnemy = new List<bool>();
-        createdBuilding = new List<bool>();
-        for (int i = 0; i < cfgCreateEnemy.Count; i++)
-        {
-            createdEnemy.Add(false);
-            createEnemyTime.Add(cfgCreateEnemy[i].Time);
-        }
-        for (int i = 0; i < cfgCreateBuilding.Count; i++)
-        {
-            createdBuilding.Add(false);
-            createBuildingTime.Add(cfgCreateBuilding[i].Time);
-        }
+        levelSelect = GetComponent<LevelSelect>();
+        curLevel = GetComponent<LevelSelect>().levelConfig[levelSelect.curLevelID - 1];
+        LoadMapAsset(0);
 
         //把所有怪物prefab生成一遍防止后面初次生成卡顿
-        foreach (var item in GameManager.instance.allCfgData.CfgEnemy.DataMap)
-        {
-            SingleEnemyConfig cfgEnemy = item.Value;
-            GameObject enemyObj = CreateEnemy(cfgEnemy.ID, Vector3.zero, 1, 1);
-            enemyObj.SetActive(false);
-        }
+        //foreach (var item in createCharacter)
+        //{
+        //    for(int i = 0; i < item.tile.spawnTime[item.spawnTimeId].num; i++)
+        //    {
+        //        CreateEnemy(item.tile, Vector3.zero, 1, 1,false);
+        //    }
+        //}
     }
 
-    public void OnGameTimeChange(float gameTime)
+
+    public void refreshHasOut(GameMap map)
     {
-        for (int i = 0; i < cfgCreateEnemy.Count; i++)
+        for (int i = 0; i < map.LayerCount; i++)
         {
-            if (cfgCreateEnemy[i].LevelID == curLevel.enemyExcelID)
+            int[] grid = map.GetlayerData(i);
+            int idx = 0;
+            for (int y = 0; y < map.height; y++)
             {
-                if (createEnemyTime[i] != 0)
-                {
-                    if (createEnemyTime[i] + cfgCreateEnemy[i].DelayTime <= gameTime && !createdEnemy[i])
-                    {
-                        createdEnemy[i] = true;
-                        StartCreateEnemy(i);
-                    }
-                }
-                else
+                for (int x = 0; x < map.width; x++)
                 {
-                    GameObject result = null;
-                    buildingDic.TryGetValue(cfgCreateEnemy[i].BuildingID, out result);
-                    if (result != null)
-                    {
-                        //根据防御塔血量出怪
-                        EnemyTower enemyTower = result.GetComponent<EnemyTower>();
-                        if (enemyTower != null && !createdEnemy[i] && enemyTower.hp * 100 <= enemyTower.totalHp * cfgCreateEnemy[i].BuildingHP)
-                        {
-                            if (cfgCreateEnemy[i].DelayTime == 0)
-                            {
-                                createdEnemy[i] = true;
-                                StartCreateEnemy(i);
-                            }
-                            else
-                            {
-                                createEnemyTime[i] = gameTime;
-                            }
-                        }
-                        //根据传送门血量出怪
-                        CoreCharacter coreCharacter = result.GetComponentInChildren<CoreCharacter>();
-                        PortalsCreater portalsCreater = result.GetComponent<PortalsCreater>();
-                        if (coreCharacter != null && !createdEnemy[i] && portalsCreater.createTimeCountDown < 0 && coreCharacter.hp * 100 <= coreCharacter.totalHp * cfgCreateEnemy[i].BuildingHP)
-                        {
-                            if (cfgCreateEnemy[i].DelayTime == 0)
-                            {
-                                createdEnemy[i] = true;
-                                StartCreateEnemy(i);
-                            }
-                            else
-                            {
-                                createEnemyTime[i] = gameTime;
-                            }
-                        }
-                    }
+                    GameMapTile t = mapsAsset.tileAsset.GetTile(grid[idx++]);
+                    if (t == null) continue;
+                    t.hasOut = false;
+                    t.index = -1;
                 }
             }
         }
-        for (int i = 0; i < cfgCreateBuilding.Count; i++)
+    }
+
+    public void LoadMapAsset(int mapIdx)
+    {
+        GameMap map = mapsAsset.maps[mapIdx];
+        refreshHasOut(map);
+        for (int i = 0; i < map.LayerCount; i++)
         {
-            if (cfgCreateBuilding[i].LevelID == curLevel.buildingExcelID)
+            int[] grid = map.GetlayerData(i);
+            int idx = 0;
+            for (int y = 0; y < map.height; y++)
             {
-                if (createBuildingTime[i] != 0)
+                for (int x = 0; x < map.width; x++)
                 {
-                    if (!createdBuilding[i]
-                    && (cfgCreateBuilding[i].Type == 0 && createBuildingTime[i] + cfgCreateBuilding[i].DelayTime - portalsCreateTime <= gameTime
-                    || cfgCreateBuilding[i].Type == 1 && createBuildingTime[i] + cfgCreateBuilding[i].DelayTime <= gameTime))
+                    GameMapTile t = mapsAsset.tileAsset.GetTile(grid[idx++]);
+                    if (t == null) continue;
+                    if (!t.hasOut)
                     {
-                        createdBuilding[i] = true;
-                        if (gameTime < portalsCreateTime)
-                        {
-                            StartCreateBuilding(i, createBuildingTime[i] - gameTime);
-                        }
-                        else
+                        t.hasOut = true;
+                        for (int j = 0; j < t.spawnTime.Length; j++)
                         {
-                            StartCreateBuilding(i, portalsCreateTime);
-                        }
-
-                    }
-                }
-                else
-                {
-                    GameObject result = null;
-                    buildingDic.TryGetValue(cfgCreateBuilding[i].RefreshBuildingID, out result);
-                    if (result != null)
-                    {
-                        //根据防御塔血量出怪
-                        EnemyTower enemyTower = result.GetComponent<EnemyTower>();
-                        if (enemyTower != null && !createdBuilding[i] && enemyTower.hp * 100 <= enemyTower.totalHp * cfgCreateBuilding[i].RefreshBuildingHP)
-                        {
-                            if (cfgCreateBuilding[i].DelayTime == 0)
-                            {
-                                createdBuilding[i] = true;
-                                StartCreateBuilding(i, portalsCreateTime);
-                            }
-                            else
-                            {
-                                createBuildingTime[i] = gameTime;
-                            }
-                        }
-                        //根据传送门血量出怪
-                        CoreCharacter coreCharacter = result.GetComponentInChildren<CoreCharacter>();
-                        PortalsCreater portalsCreater = result.GetComponent<PortalsCreater>();
-                        if (coreCharacter != null && !createdBuilding[i] && portalsCreater.createTimeCountDown < 0 && coreCharacter.hp * 100 <= coreCharacter.totalHp * cfgCreateBuilding[i].RefreshBuildingHP)
-                        {
-                            if (cfgCreateBuilding[i].DelayTime == 0)
-                            {
-                                createdBuilding[i] = true;
-                                StartCreateBuilding(i, portalsCreateTime);
-                            }
-                            else
-                            {
-                                createBuildingTime[i] = gameTime;
-                            }
+                            CreaterControl createrControl = new();
+                            createrControl.isCreated = false;
+                            createrControl.tile = t;
+                            createrControl.spawnTimeId = j;
+                            createrControl.pos = new Vector3(x, y, 0);
+                            createCharacter.Add(createrControl);
                         }
                     }
                 }
@@ -181,148 +113,109 @@ public class EnemyCreater : MonoBehaviour
         }
     }
 
-    public void StartCreateBuilding(int id,float createTime)
+    public void OnGameTimeChange(float gameTime)
     {
-        SingleCreateBuildingConfig singleCreateBuilding = cfgCreateBuilding[id];
-        if (!instance)
-        {
-            return;
-        }
-        switch (singleCreateBuilding.Type)
+        for (int i = 0; i < createCharacter.Count; i++)
         {
-            case 0:
-                List<float> pos = singleCreateBuilding.Position.Concat(singleCreateBuilding.Position1).ToList();
-                CreatePortal(singleCreateBuilding.ID, singleCreateBuilding.BuildingID, pos, singleCreateBuilding.Scale, singleCreateBuilding.HPRatio, createTime, singleCreateBuilding.DisappearTime);
-                break;
-            case 1:
-                Vector3 positon = new Vector3(singleCreateBuilding.Position[0], singleCreateBuilding.Position[1], singleCreateBuilding.Position[2]);
-                CreateEnemyTower(singleCreateBuilding.ID, singleCreateBuilding.BuildingID, singleCreateBuilding.HPRatio, singleCreateBuilding.AttackRatio, positon, singleCreateBuilding.DisappearTime);
-                break;
+            GameMapTile gameMapTile = createCharacter[i].tile;
+            if (gameMapTile.spawnTime[createCharacter[i].spawnTimeId].startTime <= gameTime && !createCharacter[i].isCreated)
+            {
+                CreaterControl createrControl = createCharacter[i];
+                createrControl.isCreated = true;
+                createCharacter[i] = createrControl;
+                StartCreateEnemy(createCharacter[i]);
+            }
         }
     }
 
-    public async void StartCreateEnemy(int id)
+    public async void StartCreateEnemy(CreaterControl createrControl)
     {
-        SingleCreateEnemyConfig singleCreateEnemy = cfgCreateEnemy[id];
-        for (int i = 0; i < singleCreateEnemy.Count; i++)
+        SpawnTime spawnTime = createrControl.tile.spawnTime[createrControl.spawnTimeId];
+        for (int i = 0; i < spawnTime.num; i++)
         {
             if (!instance)
             {
                 return;
             }
-            Vector3 pos = Vector3.zero;
-            switch (singleCreateEnemy.Type)
-            {
-                case 0:
-                    pos = new Vector3(
-                            singleCreateEnemy.Position[0],
-                            singleCreateEnemy.Position[1]
-                                + Random.Range(-singleCreateEnemy.YRandomRange / 2, singleCreateEnemy.YRandomRange / 2),
-                            singleCreateEnemy.Position[2]
-                                + Random.Range(-singleCreateEnemy.ZRandomRange / 2, singleCreateEnemy.ZRandomRange / 2));
-                    break;
-                case 1:
-                    GameObject building = buildingDic[singleCreateEnemy.BuildingID];
-                    pos = building.transform.position;
-                    pos.y += Random.Range(0, singleCreateEnemy.YRandomRange);
-                    pos.z += Random.Range(0, singleCreateEnemy.ZRandomRange);
-                    PortalsCreater portalsCreater = building.GetComponent<PortalsCreater>();
-                    if (portalsCreater != null)
-                    {
-                        portalsCreater.enemyNumber -= 1;
-                        portalsCreater.enemyNumberText.text = portalsCreater.enemyNumber.ToString();
-                    }
-                    break;
-            }
-            CreateEnemy(singleCreateEnemy.EnemyID, pos, singleCreateEnemy.HPRatio, singleCreateEnemy.AttackRatio);
-            await Task.Delay((int)(singleCreateEnemy.TimeInterval * 1000));
+            CreateEnemy(createrControl.tile, createrControl.pos, 1, 1);
+            float TimeInterval = (float)(spawnTime.endTime - spawnTime.startTime) / (spawnTime.num - 1);
+            await Task.Delay((int)(TimeInterval * 1000));
         }
     }
 
-    public void CreateEnemyTower(int ID, int buildingID, float hpRatio, float attackRatio, Vector3 pos, float disappearTime)
-    {
-        SingleBuildingConfig cfgBuilding = GameManager.instance.allCfgData.CfgBuilding.Get(buildingID);
-        GameObject towerObj = Util.Instantiate(cfgBuilding.BuildingPrefab);
-        towerObj.transform.position = pos;
-        EnemyTower enemyTower = towerObj.GetComponent<EnemyTower>();
-        buildingDic.Add(ID, towerObj);
-        enemyTower.totalHp = (int)(cfgBuilding.HP * hpRatio);
-        enemyTower.hp = enemyTower.totalHp;
-        AttackInfo attackInfo = enemyTower.attack1Infos[0];
-        attackInfo.damage = (int)(cfgBuilding.Attack * attackRatio);
-        enemyTower.attack1Infos[0] = attackInfo;
-        if(disappearTime > 0)
-        {
-            enemyTower.haveDisappearTime = true;
-            enemyTower.disappearTime = disappearTime;
-        }
-    }
 
-    public void CreatePortal(int ID, int buildingID, List<float> pos, List<float> scale, float hpRatio, float createTime, float disappearTime)
+    public GameObject CreateEnemy(GameMapTile gameMapTile, Vector3 pos, float hpRatio, float attackRatio, bool active = true)
     {
-        SingleBuildingConfig cfgBuilding = GameManager.instance.allCfgData.CfgBuilding.Get(buildingID);
-        GameObject portalObj = Util.Instantiate(cfgBuilding.BuildingPrefab);
-        PortalsCreater portalsCreater = portalObj.GetComponent<PortalsCreater>();
-        portalsCreater.id = ID;
-        buildingDic.Add(ID, portalObj);
-        portalsCreater.totalHp = (int)(cfgBuilding.HP * hpRatio);
-        portalsCreater.enemyCreater = this;
-        portalsCreater.portalUIParent = portalUIParent;
-        portalsCreater.Init(pos,scale,createTime);
-        if (portalsCreater.enemyNumber == 0)
-        {
-            portalsCreater.enemyNumberText.transform.parent.gameObject.SetActive(false);
-            if (portalsCreater.onlyEnemy)
-            {
-                portalsCreater.coreCharacter.CoreBreak();
-            }
-        }
-        if(disappearTime > 0)
-        {
-            portalsCreater.haveDisappearTime = true;
-            portalsCreater.disappearTime = disappearTime + createTime;
-        }
-    }
+        string enemyStr = $"Prefab/{Enum.GetName(typeof(GameMapTile.Type), gameMapTile.type)}/{gameMapTile.ch}";
+        GameObject enemyObj = Util.Instantiate(enemyStr, pos, active: active);
+        Parameter parameter = gameMapTile.parameter;
+        AttackInfo attackInfo;
+        switch (gameMapTile.type)
+        {
+            case GameMapTile.Type.Tower:
+                EnemyTower enemyTower = enemyObj.GetComponent<EnemyTower>();
+                Tower tower = enemyObj.GetComponent<Tower>();
+                if (enemyTower != null)
+                {
+                    enemyTower.id = gameMapTile.id;
 
-    public GameObject CreateEnemy(int enemyId, Vector3 pos, float hpRatio, float attackRatio)
-    {
-        SingleEnemyConfig cfgEnemy = GameManager.instance.allCfgData.CfgEnemy.Get(enemyId);
-        GameObject enemyObj = Util.Instantiate(cfgEnemy.EnemyPrefab, pos);
-        if (enemyId > 30000)
-        {
-            Boss boss = enemyObj.GetComponentInChildren<Boss>();
-        }
-        else
-        {
-            Enemy enemy = enemyObj.GetComponent<Enemy>();
-            enemy.id = enemyId;
-            if (!enemyDic.ContainsKey(enemyId))
-            {
-                enemyDic.Add(enemyId, new List<Enemy>());
-            }
-            enemyDic[enemyId].Add(enemy);
-            enemy.totalHp = (int)(cfgEnemy.HP * hpRatio);
-            enemy.minMoveSpeed = cfgEnemy.MinMoveSpeed;
-            enemy.maxMoveSpeed = cfgEnemy.MaxMoveSpeed;
-            for (int i = 0; i < cfgEnemy.Attack1.Count; i++)
-            {
-                AttackInfo attackInfo = enemy.attack1Infos[i];
-                attackInfo.damage = (int)(cfgEnemy.Attack1[i] * attackRatio);
-                enemy.attack1Infos[i] = attackInfo;
-            }
-            for (int i = 0; i < cfgEnemy.Attack1.Count; i++)
-            {
-                AttackInfo attackInfo = enemy.attack2Infos[i];
-                attackInfo.damage = (int)(cfgEnemy.Attack2[i] * attackRatio);
-                enemy.attack2Infos[i] = attackInfo;
-            }
-            if (enemy.canFly)
-            {
-                enemy.flyHeight = enemy.transform.position.y;
-            }
-            enemy.Init();
-            enemy.SetSortingOrder(enemy.baseSortingOrder + enemyDic[enemyId].Count);
+                    enemyTower.totalHp = (int)(parameter.HP * hpRatio);
+                    enemyTower.hp = enemyTower.totalHp;
+
+                    attackInfo = enemyTower.Attack_summonInfos[0];
+                    attackInfo.damage = (int)(parameter.Attack_summon * attackRatio);
+                    enemyTower.Attack_summonInfos[0] = attackInfo;
+                    enemyTower.Init();
+                }
+                if (tower != null)
+                {
+                    tower.id = gameMapTile.id;
+
+                    tower.totalHp = (int)(parameter.HP * hpRatio);
+                    tower.hp = tower.totalHp;
+
+                    attackInfo = enemyTower.Attack_summonInfos[0];
+                    attackInfo.damage = (int)(parameter.Attack_summon * attackRatio);
+                    tower.Attack_summonInfos[0] = attackInfo;
+                    tower.Init();
+                }
+                if (!buildingDic.ContainsKey(gameMapTile.id))
+                {
+                    buildingDic.Add(gameMapTile.id, new List<GameObject>());
+                }
+                buildingDic[gameMapTile.id].Add(enemyObj);
+
+                break;
+            case GameMapTile.Type.Enemy:
+                Enemy enemy = enemyObj.GetComponent<Enemy>();
+                enemy.id = gameMapTile.id;
+                if (!enemyDic.ContainsKey(gameMapTile.id))
+                {
+                    enemyDic.Add(gameMapTile.id, new List<Enemy>());
+                }
+                enemyDic[gameMapTile.id].Add(enemy);
+
+                enemy.totalHp = (int)(parameter.HP * hpRatio);
+                enemy.hp = enemy.totalHp;
+                enemy.minMoveSpeed = parameter.MinMoveSpeed;
+                enemy.maxMoveSpeed = parameter.MaxMoveSpeed;
+                attackInfo = enemy.Attack_summonInfos[0];
+                attackInfo.damage = (int)(parameter.Attack_summon * attackRatio);
+                enemy.Attack_summonInfos[0] = attackInfo;
+
+                attackInfo = enemy.Attack_marchInfos[0];
+                attackInfo.damage = (int)(parameter.Attack_march * attackRatio);
+                enemy.Attack_marchInfos[0] = attackInfo;
+
+                if (enemy.canFly)
+                {
+                    enemy.flyHeight = enemy.transform.position.y;
+                }
+                enemy.Init();
+                enemy.SetSortingOrder(enemy.baseSortingOrder + enemyDic[gameMapTile.id].Count);
+                break;
         }
+        enemyObj.transform.position = pos;
         return enemyObj;
     }
 
@@ -348,7 +241,7 @@ public class EnemyCreater : MonoBehaviour
             {
                 if (item.Value[i] != self && !item.Value[i].isDie && item.Value[i].gameObject.activeInHierarchy)
                 {
-                    if (!minDisEnemy || (minDisEnemy.transform.position - self.transform.position).magnitude 
+                    if (!minDisEnemy || (minDisEnemy.transform.position - self.transform.position).magnitude
                         > (item.Value[i].transform.position - self.transform.position).magnitude)
                     {
                         minDisEnemy = item.Value[i];

+ 3 - 2
ActionTowerDefense/Assets/Scripts/EnemyTower.cs

@@ -5,6 +5,7 @@ using TMPro;
 
 public class EnemyTower : Character
 {
+    public int id;
     public float height = 8;
 
     public bool haveDisappearTime; //ÓÐÏûʧʱ¼ä
@@ -53,7 +54,7 @@ public class EnemyTower : Character
             case CharacterState.Idle:
                 if (isAttack)
                 {
-                    Attack1();
+                    Attack_summon();
                     break;
                 }
                 break;
@@ -98,7 +99,7 @@ public class EnemyTower : Character
         switch (newState)
         {
             case CharacterState.Idle:
-                ani.Play("idle", 0, 0);
+                //ani.Play("idle", 0, 0);
                 aniCollider.Play("Idle", 0, 0);
                 rb.velocity = Vector3.zero;
                 //animalAni.SetInteger("state", (int)PlayerState.Idle);

+ 1 - 1
ActionTowerDefense/Assets/Scripts/GameManager.cs

@@ -41,7 +41,7 @@ public class GameManager : MonoBehaviour
     private void Start()
     {
         gameTime = 0;
-        GetAllExcel();
+        //GetAllExcel();
     }
 
     private void FixedUpdate()

+ 4 - 4
ActionTowerDefense/Assets/Scripts/Levels/LevelSelect.cs

@@ -14,10 +14,10 @@ public class LevelSelect : MonoBehaviour
     {
         [Header("关卡名称")]
         public string levelName;
-        [Header("出怪表sheet几")]
-        public int enemyExcelID;
-        [Header("建筑生成表sheet几")]
-        public int buildingExcelID;
+        //[Header("出怪表sheet几")]
+        //public int enemyExcelID;
+        //[Header("建筑生成表sheet几")]
+        //public int buildingExcelID;
     }
 
     [Header("当前关卡序号(从1开始)")]

+ 7 - 7
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -1052,7 +1052,7 @@ public class PlayerController : MoveCharacter
             //{
             //    if (excludeState != CharacterState.Attack)
             //    {
-            //        Attack1();
+            //        Attack_summon();
             //        return true;
             //    }
             //}
@@ -1945,10 +1945,10 @@ public class PlayerController : MoveCharacter
                 rb.velocity = Vector3.zero;
                 break;
             case CharacterState.Attack:
-                attackTime = totalAttack1Time;
+                attackTime = totalAttack_summonTime;
                 break;
             case CharacterState.KeepAttack:
-                aniCollider.Play("Attack1Keep", 1, 0);
+                aniCollider.Play("Attack_summonKeep", 1, 0);
                 break;
             case CharacterState.Summon:
                 aniCollider.Play("Summon", 0, 0);
@@ -2214,7 +2214,7 @@ public class PlayerController : MoveCharacter
         demonic.SetSortingOrder(order);
         if (id != 4)
         {
-            demonic.Attack1();
+            demonic.Attack_summon();
         }
         //id 3~6 ΪËĸöÓ¢Áé
         if (id >= 3 && id <= 6)
@@ -2271,9 +2271,9 @@ public class PlayerController : MoveCharacter
         return true;
     }
 
-    public override void Attack1()
+    public override void Attack_summon()
     {
-        base.Attack1();
+        base.Attack_summon();
         if (leftDir.x > 0.3f)
         {
             if (bodyTrans.localScale.x > 0)
@@ -2300,7 +2300,7 @@ public class PlayerController : MoveCharacter
     {
         attackState = value;
         ani.SetInteger("attackState", (int)value);
-        aniCollider.Play("Attack1Keep", 1, 0);
+        aniCollider.Play("Attack_summonKeep", 1, 0);
     }
 
     public void SearchTarget()

+ 53 - 53
ActionTowerDefense/Assets/Scripts/Portal/PortalsCreater.cs

@@ -86,61 +86,61 @@ public class PortalsCreater : MonoBehaviour
             }
         }
     }
-    public void Init(List<float> position, List<float> scale, float createTime)
-    {
-        transform.position = Vector3.zero;
-        transform.position = new Vector3(position[0], position[1], position[2]);
-        if(portal.Length == 2)
-        {
-            portal[1].transform.position =
-                    new Vector3(position[3], position[4], position[5]);
-            for (int i = 0; i < 2; i++)
-            {
+    //public void Init(List<float> position, List<float> scale, float createTime)
+    //{
+    //    transform.position = Vector3.zero;
+    //    transform.position = new Vector3(position[0], position[1], position[2]);
+    //    if(portal.Length == 2)
+    //    {
+    //        portal[1].transform.position =
+    //                new Vector3(position[3], position[4], position[5]);
+    //        for (int i = 0; i < 2; i++)
+    //        {
                 
-                Vector3 localScale = portal[i].transform.localScale;
-                localScale *= Mathf.Abs(scale[i]);
-                if (scale[i] < 0)
-                {
-                    localScale.x *= -1;
-                }
-                portal[i].transform.localScale = localScale;
-                portalUI[i].transform.localScale = localScale / 100;
-            }
-        }
+    //            Vector3 localScale = portal[i].transform.localScale;
+    //            localScale *= Mathf.Abs(scale[i]);
+    //            if (scale[i] < 0)
+    //            {
+    //                localScale.x *= -1;
+    //            }
+    //            portal[i].transform.localScale = localScale;
+    //            portalUI[i].transform.localScale = localScale / 100;
+    //        }
+    //    }
 
-        if(scale.Count == 2)
-        {
-            if (scale[0] != scale[1])
-            {
-                portalsControllers[0].isReverse = true;
-                portalsControllers[1].isReverse = true;
-            }
-            portalsControllers[0].onlyEnemy = onlyEnemy;
-            portalsControllers[1].onlyEnemy = onlyEnemy;
-        }
-        else
-        {
-            portalsControllers[0].onlyEnemy = true;
-        }
+    //    if(scale.Count == 2)
+    //    {
+    //        if (scale[0] != scale[1])
+    //        {
+    //            portalsControllers[0].isReverse = true;
+    //            portalsControllers[1].isReverse = true;
+    //        }
+    //        portalsControllers[0].onlyEnemy = onlyEnemy;
+    //        portalsControllers[1].onlyEnemy = onlyEnemy;
+    //    }
+    //    else
+    //    {
+    //        portalsControllers[0].onlyEnemy = true;
+    //    }
 
         
-        coreCharacter.totalHp = totalHp;
-        coreCharacter.hp = totalHp;
-        coreCharacter.uiHp.Show(totalHp, totalHp);
-        for (int i = 0; i < enemyCreater.cfgCreateEnemy.Count; i++)
-        {
-            if (enemyCreater.cfgCreateEnemy[i].BuildingID == id)
-            {
-                enemyNumber += enemyCreater.cfgCreateEnemy[i].Count;
-            }
-        }
-        enemyNumberText.text = enemyNumber.ToString();
-        ani.speed = totalCreateTimeCountDown/createTime;
-        ani.Play("Create", 0, 0);
-        countDownUI = Instantiate(countDownUIPrefeb, portalUIParent);
-        portalsDownUI = countDownUI.GetComponent<PortalsCountDownUI>();
-        portalsDownUI.portalPos = portal[0].transform.position; 
-        createTimeCountDown = createTime;
-        print(createTimeCountDown);
-    }
+    //    coreCharacter.totalHp = totalHp;
+    //    coreCharacter.hp = totalHp;
+    //    coreCharacter.uiHp.Show(totalHp, totalHp);
+    //    for (int i = 0; i < enemyCreater.cfgCreateEnemy.Count; i++)
+    //    {
+    //        if (enemyCreater.cfgCreateEnemy[i].BuildingID == id)
+    //        {
+    //            enemyNumber += enemyCreater.cfgCreateEnemy[i].Count;
+    //        }
+    //    }
+    //    enemyNumberText.text = enemyNumber.ToString();
+    //    ani.speed = totalCreateTimeCountDown/createTime;
+    //    ani.Play("Create", 0, 0);
+    //    countDownUI = Instantiate(countDownUIPrefeb, portalUIParent);
+    //    portalsDownUI = countDownUI.GetComponent<PortalsCountDownUI>();
+    //    portalsDownUI.portalPos = portal[0].transform.position; 
+    //    createTimeCountDown = createTime;
+    //    print(createTimeCountDown);
+    //}
 }

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Spirits/DashEffect.cs

@@ -23,11 +23,11 @@ public class DashEffect : MonoBehaviour
         {
             if (isEnemy)
             {
-                attackInfo = GetComponentInParent<Enemy>().attack1Infos[0];
+                attackInfo = GetComponentInParent<Enemy>().Attack_summonInfos[0];
             }
             else
             {
-                attackInfo = GetComponentInParent<Demonic>().attack1Infos[0];
+                attackInfo = GetComponentInParent<Demonic>().Attack_summonInfos[0];
             }
         }
     }

+ 1 - 1
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Cook.cs

@@ -72,7 +72,7 @@ public class ESpirits_Cook : MonoBehaviour
                         isInterval = true;
                         chuan -= 1;
                         text.text = chuan.ToString();
-                        ani.Play("attack_march", 0, 0);
+                        ani.Play("Attack_march", 0, 0);
                         if (target.cookEffect == null)
                         {
                             target.cookEffect = Instantiate(effect, target.transform.position, new Quaternion(0, 0, 0, 0), target.transform);

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Spirits/Trans_Assassin.cs

@@ -77,7 +77,7 @@ public class Trans_Assassin : MonoBehaviour
             case Trans_AssassinState.Rush:
                 dashEffect.canHit = true;
                 aimEffect.SetActive(false);
-                player.ani.Play("attack_summon", 0, 0);
+                player.ani.Play("Attack_summon", 0, 0);
                 Rush();
                 time += Time.deltaTime;
                 if (time >= rushTime)
@@ -130,7 +130,7 @@ public class Trans_Assassin : MonoBehaviour
             case Trans_AssassinState.SecondRush:
                 dashEffect.canHit = true;
                 aimEffect.SetActive(false);
-                player.ani.Play("attack_summon", 0, 0);
+                player.ani.Play("Attack_summon", 0, 0);
                 Rush();
                 time += Time.deltaTime;
                 if (time >= rushTime)

+ 4 - 5
ActionTowerDefense/Assets/Scripts/Tower.cs

@@ -7,16 +7,15 @@ using TMPro;
 public class Tower : Character
 {
     [Header("ËþÐÅÏ¢")]
+    public int id;
     public bool isLockSoul;
     public float height = 8;
     private void Awake()
     {
         TowerMap.myTowers.Add(gameObject);
-
         Init();
-        
-    }
 
+    }
     public bool GetAttack()
     {
         if (targetCharacter != null)
@@ -43,7 +42,7 @@ public class Tower : Character
             case CharacterState.Idle:
                 if (isAttack)
                 {
-                    Attack1();
+                    Attack_summon();
                     break;
                 }
                 break;
@@ -87,7 +86,7 @@ public class Tower : Character
         switch (newState)
         {
             case CharacterState.Idle:
-                ani.Play("idle", 0, 0);
+                //ani.Play("idle", 0, 0);
                 aniCollider.Play("Idle", 0, 0);
                 rb.velocity = Vector3.zero;
                 //animalAni.SetInteger("state", (int)PlayerState.Idle);

+ 2 - 2
ActionTowerDefense/Assets/Scripts/Util.cs

@@ -118,7 +118,7 @@ namespace Base.Common
             return prefab;
         }
 
-        public static GameObject Instantiate(string path, Vector3 pos = default, Quaternion rotation = default, Transform parent = null)
+        public static GameObject Instantiate(string path, Vector3 pos = default, Quaternion rotation = default, Transform parent = null, bool active = true)
         {
             GameObject prefab;
             
@@ -133,7 +133,7 @@ namespace Base.Common
             if (prefab != null)
             {
                 gameObject = PoolManager.Instantiate(prefab, pos, rotation, parent);
-                gameObject.SetActive(true);
+                gameObject.SetActive(active);
             }
             else
             {

二進制
ActionTowerDefense/Luban/Config/Datas/~$出怪表.xlsx


二進制
ActionTowerDefense/Luban/Config/Datas/~$怪物表.xlsx