Procházet zdrojové kódy

改了伞特效的逻辑,加上boss出场和死亡的特效

HY-LSZNWIN10\Administrator před 1 dnem
rodič
revize
ed4574676c

+ 2 - 0
ActionTowerDefense/Assets/Editor/SpineSettings.asset

@@ -17,6 +17,8 @@ MonoBehaviour:
   defaultShader: Spine/Skeleton
   defaultZSpacing: 0
   defaultInstantiateLoop: 1
+  defaultPhysicsPositionInheritance: {x: 1, y: 1}
+  defaultPhysicsRotationInheritance: 1
   showHierarchyIcons: 1
   reloadAfterPlayMode: 1
   setTextureImporterSettings: 1

+ 9 - 9
ActionTowerDefense/Assets/Resources/Prefab/Boss/WaterSprite/Boss_Braid.prefab

@@ -390,12 +390,12 @@ MonoBehaviour:
   bossPhase: 0
   statOfPhase:
   - hpRadioThreshold: 1
-    maxInterval: 2.5
-    minInterval: 2.2
-  - hpRadioThreshold: 0.6
-    maxInterval: 2.2
+    maxInterval: 5
+    minInterval: 3
+  - hpRadioThreshold: 0.7
+    maxInterval: 3
     minInterval: 2
-  - hpRadioThreshold: 0.3
+  - hpRadioThreshold: 0.4
     maxInterval: 2
     minInterval: 1.8
   idleAniNames:
@@ -429,7 +429,6 @@ MonoBehaviour:
   dropSoulMax: 8
   dropSoulMin: 6
   dropSoulAngle: 60
-  wsAttackController: {fileID: 16214313399265844}
   attackConfigurations:
   - category: 0
     attacks:
@@ -438,7 +437,7 @@ MonoBehaviour:
   - category: 1
     attacks:
     - attack: 1
-      weight: 3
+      weight: 5
     - attack: 3
       weight: 0
     - attack: 5
@@ -473,13 +472,14 @@ MonoBehaviour:
   isDisappear: 0
   polliNum: 100
   pws: {fileID: 566765055176838525}
-  changeStateHPPer: 50000000320000001e0000000a000000
+  changeStateHPPer: 46000000320000001e0000000a000000
   polliTime: 10
   angryAttackInterval: 1.5
   angryDuration: 10
   isAngry: 0
   isTakingUmbre: 0
   isHoldingUmbre: 1
+  smokeShell: {fileID: 417478504669294145, guid: b00dd469a1c512e4493fb64fa1ca01cc, type: 3}
 --- !u!114 &16214313399265844
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -1577,7 +1577,7 @@ MonoBehaviour:
   translator:
     autoReset: 1
     useCustomMixMode: 1
-    layerMixModes: 00000000
+    layerMixModes: 01000000
     layerBlendModes: 01000000
   updateTiming: 1
 --- !u!1 &16214314582601927

+ 78 - 2
ActionTowerDefense/Assets/Resources/Prefab/Boss/WaterSprite/Boss_Umbrella.prefab

@@ -10100,7 +10100,7 @@ MeshRenderer:
   m_LightmapParameters: {fileID: 0}
   m_SortingLayerID: 341237651
   m_SortingLayer: 3
-  m_SortingOrder: 0
+  m_SortingOrder: 208
   m_AdditionalVertexStreams: {fileID: 0}
 --- !u!95 &5733499163905850020
 Animator:
@@ -10198,6 +10198,7 @@ Transform:
   m_Children:
   - {fileID: 5733499163813085000}
   - {fileID: 4120758553239829648}
+  - {fileID: 2716627639776660233}
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -10244,10 +10245,85 @@ MonoBehaviour:
   attentionyTime: 0.3
   backTime: 0.6
   disappearTime: 0.2
-  effect: {fileID: 7473170563405908938, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+  effectIns: {fileID: 2716627639776660234}
   initialTransparency: 0.2
   leftX: -9
   rightX: 9
   leftBoundary: 60
   rightBoundary: 120
   maxHeight: 40
+--- !u!1001 &4757331149122060480
+PrefabInstance:
+  m_ObjectHideFlags: 0
+  serializedVersion: 2
+  m_Modification:
+    m_TransformParent: {fileID: 5733499164336919472}
+    m_Modifications:
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_RootOrder
+      value: 2
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalScale.x
+      value: 35.24
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalScale.y
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 12.7
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: -1.2
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalRotation.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalRotation.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalRotation.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 7473170563405908938, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+      propertyPath: m_Name
+      value: Effc_umbralla_alarm
+      objectReference: {fileID: 0}
+    m_RemovedComponents: []
+  m_SourcePrefab: {fileID: 100100000, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+--- !u!4 &2716627639776660233 stripped
+Transform:
+  m_CorrespondingSourceObject: {fileID: 7473170563405908937, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+  m_PrefabInstance: {fileID: 4757331149122060480}
+  m_PrefabAsset: {fileID: 0}
+--- !u!1 &2716627639776660234 stripped
+GameObject:
+  m_CorrespondingSourceObject: {fileID: 7473170563405908938, guid: 8d195dec6a5551844ba6e4a0a4af3b59, type: 3}
+  m_PrefabInstance: {fileID: 4757331149122060480}
+  m_PrefabAsset: {fileID: 0}

+ 38 - 34
ActionTowerDefense/Assets/Scripts/Boss/WaterGhost/BlackUmbrella.cs

@@ -60,8 +60,8 @@ public class BlackUmbrella : MonoBehaviour
     [LabelText("黑伞消失时长")]
     public float disappearTime;
     [LabelText("黑伞位置提示特效")]
-    public GameObject effect;
-    private GameObject effectIns;
+    //public GameObject effect;
+    public GameObject effectIns;
     private SpriteRenderer effectInsSr;
     public float initialTransparency = 0.5f;
     //提示X坐标
@@ -81,6 +81,7 @@ public class BlackUmbrella : MonoBehaviour
         attackCon = owner.GetComponent<WaterSpriteAttackController>();
         pc = PlayersInput.instance[0];
         ani.runtimeAnimatorController = rac;
+        effectIns.GetComponent<Bullet>().owner = ws;
     }
 
     //放出这个攻击!
@@ -199,14 +200,12 @@ public class BlackUmbrella : MonoBehaviour
                 {
                     umbrePastTime = 0;
                     hasBackAni = false;
-                    ws.isHoldingUmbre = true;
                     ChangeUmbrellaState(UmbrellaState.disappear);
                 }
                 else if (!hasBackAni && umbrePastTime >= backTime - 0.6f)
                 {
                     hasBackAni = true;
                     attackCon.isUmbrellaBack = true;
-                    ws.isHoldingUmbre = true;
                 }
                 //if(transform.position.y < 4)
                 //{
@@ -252,18 +251,23 @@ public class BlackUmbrella : MonoBehaviour
 
     private void ShowTip()
     {
-        if (!effectIns)
-        {
-            effectIns = PoolManager.Instantiate(effect, Camera.main.transform);
-            effectIns.GetComponent<Bullet>().owner = ws;
-            effectInsSr = effectIns.GetComponentInChildren<SpriteRenderer>();
+        //if (!effectIns)
+        //{
+        //    effectIns = PoolManager.Instantiate(effect, Camera.main.transform);
+        //    effectIns.GetComponent<Bullet>().owner = ws;
+        //    effectInsSr = effectIns.GetComponentInChildren<SpriteRenderer>();
 
-            // 初始化透明度为半透明(假设原本是0.5)
-            var color = effectInsSr.color;
-            color.a = initialTransparency;
-            effectInsSr.color = color;
-        }
+        //    // 初始化透明度为半透明(假设原本是0.5)
+        //    var color = effectInsSr.color;
+        //    color.a = initialTransparency;
+        //    effectInsSr.color = color;
+        //}
+        effectInsSr = effectIns.GetComponentInChildren<SpriteRenderer>();
 
+        // 初始化透明度为半透明(假设原本是0.5)
+        var color = effectInsSr.color;
+        color.a = initialTransparency;
+        effectInsSr.color = color;
         //bool isAboutToAttack = umbrellaState == UmbrellaState.stay
         //               && allTime > 0
         //               && (stayTime - umbrePastTime) <= 1f;
@@ -271,21 +275,21 @@ public class BlackUmbrella : MonoBehaviour
         bool isAboutToAttack = umbrellaState == UmbrellaState.stay
                && (umbrePastTime - stayTime)> 0;
 
-        if (!IsTargetVisible(gameObject) && umbrellaState == UmbrellaState.stay && allTime > -1)
+        if (/*!IsTargetVisible(gameObject) && */umbrellaState == UmbrellaState.stay && allTime > -1)
         {
             if (isAboutToAttack)
             {
                 // 剩余时间在0-1秒之间,计算透明度(0.5 -> 1.0)
                 float remainingTime = umbrePastTime - stayTime;
                 float alpha = Mathf.Lerp(initialTransparency, 1f , remainingTime * 1/ attentionyTime); // 时间越少透明度越高
-                var color = effectInsSr.color;
+                color = effectInsSr.color;
                 color.a = alpha;
                 effectInsSr.color = color;
             }
             else
             {
                 // 非攻击状态保持半透明
-                var color = effectInsSr.color;
+                color = effectInsSr.color;
                 if (color.a != initialTransparency)
                 {
                     color.a = initialTransparency;
@@ -293,29 +297,29 @@ public class BlackUmbrella : MonoBehaviour
                 }
             }
 
-            if (gameObject.transform.position.x > pc.transform.position.x)
-            {
-                effectIns.transform.localPosition = new Vector3(rightX, 0, 16);
-                Vector3 pos = effectIns.transform.position;
-                pos.y = gameObject.transform.position.y;
-                effectIns.transform.position = pos;
-                effectIns.transform.localEulerAngles = new Vector3(0.8f, 0.1f, 1);
-            }
-            else
-            {
-                effectIns.transform.localPosition = new Vector3(leftX, 0, 16);
-                Vector3 pos = effectIns.transform.position;
-                pos.y = gameObject.transform.position.y;
-                effectIns.transform.position = pos;
-                effectIns.transform.localEulerAngles = new Vector3(-0.8f, 0.1f, 1);
-            }
+            //if (gameObject.transform.position.x > pc.transform.position.x)
+            //{
+            //    effectIns.transform.localPosition = new Vector3(rightX, 0, 16);
+            //    Vector3 pos = effectIns.transform.position;
+            //    pos.y = gameObject.transform.position.y;
+            //    effectIns.transform.position = pos;
+            //    effectIns.transform.localEulerAngles = new Vector3(0.8f, 0.1f, 1);
+            //}
+            //else
+            //{
+            //    effectIns.transform.localPosition = new Vector3(leftX, 0, 16);
+            //    Vector3 pos = effectIns.transform.position;
+            //    pos.y = gameObject.transform.position.y;
+            //    effectIns.transform.position = pos;
+                //effectIns.transform.localEulerAngles = new Vector3(-0.8f, 0.1f, 1);
+            //}
             effectIns.SetActive(true);
         }
         else
         {
             effectIns.SetActive(false);
             // 重置透明度为半透明,避免下次显示时状态错误
-            var color = effectInsSr.color;
+            color = effectInsSr.color;
             if (color.a != initialTransparency)
             {
                 color.a = initialTransparency;

+ 42 - 12
ActionTowerDefense/Assets/Scripts/Boss/WaterGhost/WaterSprite.cs

@@ -34,7 +34,6 @@ public class WaterSprite : Boss
         public AttackCategories category;
         public AttackAssignment[] attacks;
     }
-    [FoldoutGroup("组件")] public WaterSpriteAttackController wsAttackController;
     [Space(30)]
     [Header("水诡白家娘娘")]
     [Header("攻击配置")]
@@ -76,6 +75,9 @@ public class WaterSprite : Boss
     [FoldoutGroup("状态提示")] public bool isAngry = false;
     [FoldoutGroup("状态提示")] public bool isTakingUmbre = false;
     [FoldoutGroup("状态提示")] public bool isHoldingUmbre = true;
+    private Coroutine shootCoroutine;
+    private float hairAttackTimer;
+    public GameObject smokeShell;
 
     public override void Init()
     {
@@ -85,6 +87,8 @@ public class WaterSprite : Boss
         jumpMoveCS.ws = this;
         nextAimHP = (int)(changeStateHPPer[changeHPID] / 100f * totalHp);
         changeHPID++;
+        curInterval = 6f;
+        StartCoroutine(Appear());
     }
 
     public override void Update()
@@ -99,8 +103,8 @@ public class WaterSprite : Boss
             {
                 Debug.Log("退出愤怒状态");
                 isAngry = false;
-                bodyTrans.gameObject.SetActive(true);
-                ChangeCirculate(2);
+                StartCoroutine(Appear());
+                ChangeCirculate(3);
             }
         }
         if(!isHoldingUmbre) attack.OnBlackUmbrella();
@@ -159,6 +163,9 @@ public class WaterSprite : Boss
         switch (bossPhase)
         {
             case 1:
+                ChangeCirculate(2);
+                break;
+            case 2:
                 ChangeCirculate(1);
                 bodyTrans.gameObject.SetActive(false);
                 isAngry = true;
@@ -167,19 +174,18 @@ public class WaterSprite : Boss
                 ClearAllSkills();
                 isTakingUmbre = false;
                 break;
-            case 2:
-                ChangeCirculate(3);
-                break;
         }
     }
 
     public override void ClearAllSkills()
     {
-        if (attack.blackUmbrella.gameObject.activeSelf)
+        if (attack.blackUmbrella)
         {
+            if(attack.blackUmbrella.gameObject.activeSelf)
             attack.blackUmbrella.BeCleared();
             isHoldingUmbre = true;
         }
+        StopCoroutine(shootCoroutine);
     }
 
     public override void ChangeBossState(BossState bs)
@@ -194,7 +200,7 @@ public class WaterSprite : Boss
         {
             return;
         }
-        //Debug.Log("从" + state + "切换到" + newState);
+        Debug.Log("从" + state + "切换到" + newState);
         switch (state)
         {
             case CharacterState.Run:
@@ -229,7 +235,9 @@ public class WaterSprite : Boss
                 break;
             case CharacterState.Die:
                 ani.Play("die", 0, 0);
-                gameObject.SetActive(false);
+                rb.constraints &= ~RigidbodyConstraints.FreezePositionY;
+                ChangeBossState(BossState.invincible);
+                StartCoroutine(DieEnd(13.067f));
                 ClearAllSkills();
                 break;
             case CharacterState.Attack:
@@ -338,6 +346,26 @@ public class WaterSprite : Boss
     }
     #endregion
 
+    IEnumerator DieEnd(float time)
+    {
+        yield return new WaitForSeconds(time);
+        gameObject.SetActive(false);
+    }
+
+    IEnumerator Appear()
+    {
+        ChangeBossState(BossState.invincible);
+        PoolManager.Instantiate(smokeShell, transform.position);
+        bodyTrans.gameObject.SetActive(false);
+        yield return new WaitForSeconds(1.5f);
+        bodyTrans.gameObject.SetActive(true);
+        ani.Play("smoke");
+        yield return new WaitForSeconds(1.7f);
+        spineEvent.isAttackOn = false;
+        ChangeBossState(BossState.normal);
+        ani.Play("idle");
+    }
+
     #region 形态相关
     public void ChangeStage(BossStage bs)
     {
@@ -358,7 +386,7 @@ public class WaterSprite : Boss
                 {
                     nextAimHP = -1000;
                 }
-                bodyTrans.gameObject.SetActive(true);
+                StartCoroutine(Appear());
                 //所有蝌蚪消失
                 pws.AllPoliDie();
                 break;
@@ -397,6 +425,7 @@ public class WaterSprite : Boss
     public override void Attack()
     {
         attackCount--;
+        spineEvent.isAttackOn = false;
         switch (curAttackType)
         {
             case AttackMethods.Move:
@@ -406,7 +435,6 @@ public class WaterSprite : Boss
             case AttackMethods.Umbrella:
                 isHoldingUmbre = false;
                 ani.Play("shoot");
-                attack.SkillBlackUmbrella();
                 break;
             case AttackMethods.Hair:
                 ani.Play("roar");
@@ -426,6 +454,7 @@ public class WaterSprite : Boss
                 if (isAngry) attackTimes = 10;
                 attack.SkillHairSprint(attackTimes);
                 ChangeBossState(BossState.invincible);
+                hairAttackTimer = Time.time;
                 break;
             case AttackMethods.Shoot:
                 if (isHoldingUmbre) ani.Play("smoke", 0, 0);
@@ -446,6 +475,7 @@ public class WaterSprite : Boss
                 if (spineEvent.isAttackOn)
                 {
                     spineEvent.isAttackOn = false;
+                    attack.SkillBlackUmbrella();
                     attack.BlackUmbrellaRelease();
                     ChangeState(CharacterState.Run);
                 }
@@ -486,7 +516,7 @@ public class WaterSprite : Boss
                                 attack.KunaiAttack((pc.transform.position - pws.transform.position).normalized, num,8);
                                 break;
                             case 1:
-                                StartCoroutine(TestAttack(bossPhase));
+                                shootCoroutine = StartCoroutine(TestAttack(bossPhase));
                                 break;
                         }  
                         EndCurAttackState(true);

+ 1 - 0
ActionTowerDefense/Assets/Scripts/Boss/WaterGhost/WaterSpriteAttackController.cs

@@ -77,6 +77,7 @@ public class WaterSpriteAttackController : AttackController
         ws.isTakingUmbre = false;
         ws.curInterval = 3f;
         ws.ani.Play("shoot_end", 0, 0);
+        ws.isHoldingUmbre = true;
         //if (ws.isDisappear)
         //{
         //    //ws.curInterval = 1;

+ 1 - 1
ActionTowerDefense/Assets/material/cat_icon.mat

@@ -41,7 +41,7 @@ Material:
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
     - _MainTex:
-        m_Texture: {fileID: 2800000, guid: 673c57aa6d71883439ef1ed8eed714a0, type: 3}
+        m_Texture: {fileID: 2800000, guid: 436eb78ac141ddd46a4ed02784783e8c, type: 3}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
     - _MetallicGlossMap: