소스 검색

boss新增强制切换状态

SZAND\msx_2 2 달 전
부모
커밋
f4a2ce7250

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 468 - 277
ActionTowerDefense/Assets/Resources/Prefab/Boss/WaterSprite/Boss_Braid.prefab


+ 123 - 0
ActionTowerDefense/Assets/Resources/Prefab/Enemy/Enemy_LeafGhost.prefab

@@ -422,6 +422,7 @@ Transform:
   - {fileID: 6123532139957655505}
   - {fileID: 7192754313896565376}
   - {fileID: 139066381358821350}
+  - {fileID: 1503186420862043255}
   m_Father: {fileID: 646884720114117071}
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -61088,6 +61089,7 @@ MonoBehaviour:
   type: -1
   searchState: 0
   attackRatio: 0
+  len: 0
   dropSoulMax: 3
   dropSoulMin: 1
   dropProbability: 100
@@ -61112,6 +61114,123 @@ Rigidbody:
   m_Interpolate: 0
   m_Constraints: 124
   m_CollisionDetection: 1
+--- !u!1 &8030392804239599585
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1503186420862043255}
+  - component: {fileID: 342927852174843526}
+  - component: {fileID: 8931552650738553637}
+  m_Layer: 20
+  m_Name: AttackTrigger (1)
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &1503186420862043255
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8030392804239599585}
+  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_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 3248298059236281109}
+  m_RootOrder: 6
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!65 &342927852174843526
+BoxCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8030392804239599585}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 1
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Size: {x: 0.9009249, y: 0.9290724, z: 2}
+  m_Center: {x: -0.04878694, y: 0.055027604, z: 0}
+--- !u!114 &8931552650738553637
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8030392804239599585}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 5eaed0a6b9d6fc6409bef80cf41a0a8e, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  canBreakWall: 0
+  wallBrealNum: 10
+  isShoot: 0
+  type: 1
+  owner: {fileID: 0}
+  isSingleAttack: 0
+  cantSingleAttack: 0
+  trigedObjs: []
+  attackInfo:
+    attackValue: 0
+    damage: 50
+    attackDir: {x: 0, y: 0, z: 0}
+    attackEffect: 
+    floatState:
+      time: 0
+      upTime: {x: 0, y: 0}
+      backSpeed: {x: 0, y: 0}
+      rotateSpeed: {x: 0, y: 0}
+      height: {x: 0, y: 0}
+      ControlOrder: 0
+    blowUp:
+      directionType: 0
+      dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
+      force: 0
+      time: 0
+      haveLandingDamage: 0
+      landingDamageRate: 0
+      ControlOrder: 0
+    shotDown:
+      directionType: 0
+      dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
+      force: 0
+      time: 0
+      haveLandingDamage: 0
+      landingDamage: 0
+      ControlOrder: 0
+    weak:
+      time: 0
+      ControlOrder: 0
+    armorPiercing:
+      rate: 0
+    vulnerable:
+      rate: 0
+      time: 0
+    stackingWounds:
+      damage: 0
+      time: 0
+    changeDamage:
+      rate: 0
+    sustainedInjury:
+      damage: 0
+    isDemSummon: 0
+  force: {x: 0, y: 0, z: 0}
+  changeHurt: 0
+  repelValue: 0
+  offsetY: 1
+  hitRate: 1
 --- !u!1 &8044881819786100392
 GameObject:
   m_ObjectHideFlags: 0
@@ -71349,6 +71468,10 @@ PrefabInstance:
       propertyPath: owner
       value: 
       objectReference: {fileID: 0}
+    - target: {fileID: 8037570893049300279, guid: eaa2878313f538a4bbda9b7b886a9327, type: 3}
+      propertyPath: atcTrig
+      value: 
+      objectReference: {fileID: 8931552650738553637}
     - target: {fileID: 8037570893049300279, guid: eaa2878313f538a4bbda9b7b886a9327, type: 3}
       propertyPath: jumpSpeed
       value: 30

+ 61 - 69
ActionTowerDefense/Assets/Scenes/Game.unity

@@ -18437,75 +18437,6 @@ Transform:
   m_Father: {fileID: 1932370447}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!1001 &1092497756
-PrefabInstance:
-  m_ObjectHideFlags: 0
-  serializedVersion: 2
-  m_Modification:
-    m_TransformParent: {fileID: 0}
-    m_Modifications:
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_RootOrder
-      value: 15
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalPosition.x
-      value: 157.4
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalPosition.y
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalPosition.z
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalRotation.x
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalRotation.y
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalRotation.z
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.x
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.y
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397377, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.z
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397388, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_Name
-      value: Boss_Braid
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397388, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_IsActive
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 8845939565374397391, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: newBG
-      value: 
-      objectReference: {fileID: 347892489}
-    - target: {fileID: 8845939566515389795, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
-      propertyPath: m_Mesh
-      value: 
-      objectReference: {fileID: 0}
-    m_RemovedComponents: []
-  m_SourcePrefab: {fileID: 100100000, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
 --- !u!1001 &1126909429
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -29291,6 +29222,67 @@ MonoBehaviour:
   m_FillOrigin: 0
   m_UseSpriteMesh: 0
   m_PixelsPerUnitMultiplier: 1
+--- !u!1001 &8861551347419857062
+PrefabInstance:
+  m_ObjectHideFlags: 0
+  serializedVersion: 2
+  m_Modification:
+    m_TransformParent: {fileID: 0}
+    m_Modifications:
+    - target: {fileID: 16214313399265845, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: newBG
+      value: 
+      objectReference: {fileID: 347892489}
+    - target: {fileID: 16214313399265846, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_Name
+      value: Boss_Braid
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_RootOrder
+      value: 15
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 157.4
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalRotation.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalRotation.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalRotation.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 16214313399265851, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.z
+      value: 0
+      objectReference: {fileID: 0}
+    m_RemovedComponents: []
+  m_SourcePrefab: {fileID: 100100000, guid: 26eab5e2ec3352742b426b1737c54579, type: 3}
 --- !u!1001 &9025032025531048501
 PrefabInstance:
   m_ObjectHideFlags: 0

+ 31 - 7
ActionTowerDefense/Assets/Scripts/Boss/Boss.cs

@@ -29,6 +29,7 @@ public class Boss : MoveCharacter
         normal = 0,
         weak = 1,
         invincible = 2,
+        rise = 3,       //从weak回到normal时回升高度
     }
 
     [Space(30)]
@@ -61,6 +62,7 @@ public class Boss : MoveCharacter
     public float[] delPorpotation;
     private int curDelPorID;
     private int curTotalPatience;           //当前耐力值上限
+    private bool noNeedChange;              //耐力值到底了,不用再缩减了
     [LabelText("虚弱时长")]
     public float weakTime;
     private float pastWeakTime;
@@ -92,6 +94,8 @@ public class Boss : MoveCharacter
     public float changeRoomTime;
     private float changeAniTime;
 
+    private AttributeStatus status;
+
     public override void Init()
     {
         //确保组件不丢失
@@ -116,6 +120,9 @@ public class Boss : MoveCharacter
         curTotalPatience = totalPatience;
         curPatience = curTotalPatience;
         uiPatience.Show(curPatience, curTotalPatience);
+
+        //特殊状态脚本
+        status = beHitTrigger.GetComponent<AttributeStatus>();
     }
 
     public virtual void Start()
@@ -204,16 +211,22 @@ public class Boss : MoveCharacter
             case BossState.weak:
                 //计算当前耐力值上限缩减程度
                 rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionY;
-                AdjustHeight();
                 float curDelPor = delPorpotation[curDelPorID];
                 if (curDelPorID < delPorpotation.Length - 1)
                 {
                     curDelPorID++;
                 }
-                //调整耐力值UI长度
-                uiPatience.ChangeLength(curDelPor);
-                //调整耐力值上限
-                curTotalPatience = (int)(totalPatience * curDelPor);
+                else
+                {
+                    noNeedChange = true;
+                }
+                if (!noNeedChange)
+                {
+                    //调整耐力值UI长度
+                    uiPatience.ChangeLength(curDelPor);
+                    //调整耐力值上限
+                    curTotalPatience = (int)(totalPatience * curDelPor);
+                }
                 //将当前耐力值重置为新上限
                 curPatience = curTotalPatience;
                 //重置耐力条
@@ -225,6 +238,8 @@ public class Boss : MoveCharacter
         switch (bs)
         {
             case BossState.normal:
+                status.OutSpecialState();
+                rb.velocity = Vector3.zero;
                 break;
             case BossState.weak:
                 ani.Play("fall", 0, 0);
@@ -232,6 +247,9 @@ public class Boss : MoveCharacter
                 ChangeState(CharacterState.Idle);
                 pastWeakTime = weakTime;
                 break;
+            case BossState.rise:
+                flyHeight = Random.Range(minFlyHeight, maxFlyHeight);
+                break;
             case BossState.invincible:
                 break;
         }
@@ -245,6 +263,12 @@ public class Boss : MoveCharacter
             case BossState.weak:
                 pastWeakTime -= Time.deltaTime;
                 if (pastWeakTime <= 0)
+                {
+                    ChangeBossState(BossState.rise);
+                }
+                break;
+            case BossState.rise:
+                if (AdjustHeight())
                 {
                     ChangeBossState(BossState.normal);
                 }
@@ -376,7 +400,7 @@ public class Boss : MoveCharacter
             curInterval = Random.Range(minInterval, maxInterval);
         }
         ChangeState(CharacterState.Idle);
-        ChangeBossState(BossState.normal);
+        ChangeBossState(BossState.rise);
     }
     
     //权重随机
@@ -460,7 +484,7 @@ public class Boss : MoveCharacter
                     changeAniTime = 0;
                     isToBossRoom = false;
                     ChangeState(CharacterState.Idle);
-                    ChangeBossState(BossState.normal);
+                    ChangeBossState(BossState.rise);
                 }
                 break;
             default:

+ 4 - 1
ActionTowerDefense/Assets/Scripts/Boss/WaterGhost/LeafGhost_UpDown.cs

@@ -13,9 +13,12 @@ public class LeafGhost_UpDown : SpecialSkills
     private bool isJumping;
     private bool isFalling;
 
+    public AttackTrigger atcTrig;
+
     private void OnEnable()
     {
         targetY = targetPosition.position.y;
+        atcTrig.gameObject.SetActive(true);
     }
 
     public override void Attack()
@@ -50,7 +53,7 @@ public class LeafGhost_UpDown : SpecialSkills
                 isFalling = false;
                 owner.ani.Play("fall_to_idle", 0, 0);
                 owner.ChangeState(CharacterState.Idle);
-                gameObject.SetActive(false);
+                atcTrig.gameObject.SetActive(false);
             }
         }
     }

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.