Prechádzať zdrojové kódy

玩家在地面召唤时硬直

SZAND\msx_2 6 mesiacov pred
rodič
commit
d18a63e3db

+ 22 - 0
ActionTowerDefense/Assets/Scripts/Characters/AttackController.cs

@@ -246,6 +246,12 @@ public class AttackController : MonoBehaviour
     public GameObject addAttackEffect;
     [HideInInspector]
     public SpecialSkills skill;
+    [HideInInspector]
+    public GameObject attackEffect;
+    [HideInInspector]
+    public Dictionary<string, GameObject> effects;
+    [HideInInspector]
+    public GameObject effect;
 
     [Header("¹¥»÷·¶Î§")]
     [HideInInspector]
@@ -283,6 +289,7 @@ public class AttackController : MonoBehaviour
             attackInfo = attackMethod[0].attackInfo;
             curDamage = attackInfo.damage;
         }
+        effects = new Dictionary<string, GameObject>();
     }
 
     private void OnEnable()
@@ -315,6 +322,7 @@ public class AttackController : MonoBehaviour
             skill = curAttackMethod.skill;
             skill.owner = owner;
         }
+        attackEffect = curAttackMethod.attackEffect;
     }
 
     public void SetNextKeyTimes()
@@ -366,6 +374,20 @@ public class AttackController : MonoBehaviour
 
     public virtual void Attack_march(int id)
     {
+        if (attackEffect != null)
+        {
+            if (effects.ContainsKey(attackEffect.name))
+            {
+                effect = effects[attackEffect.name];
+                effect.SetActive(true);
+            }
+            else
+            {
+                effects[attackEffect.name] = Instantiate(attackEffect, owner.bodyTrans);
+                effect = effects[attackEffect.name];
+                effect.SetActive(true);
+            }
+        }
         Vector3 leftDir = owner.GetMoveDir();
         if (leftDir.x > 0.3f)
         {

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

@@ -596,6 +596,10 @@ public class Demonic : MoveCharacter
                 canMove = true;
                 break;
             case CharacterState.Attack:
+                if (attackController.effect)
+                {
+                    attackController.effect.SetActive(false);
+                }
                 break;
             case CharacterState.Die:
                 isDie = false;

+ 6 - 107
ActionTowerDefense/Assets/Scripts/Characters/PlayerController.cs

@@ -31,15 +31,6 @@ public class PlayerController : MoveCharacter
     public bool endTranSummon;  //是否在结束变身后召唤英灵
     public Animator aniCollider;
 
-    [Header("变身英灵")]
-    public bool isUltimate;     //英灵释放大招
-    public bool keyTransfigurateRelease;    //松开英灵释放大招键
-    public List<GameObject> changePrefabs;
-    public int[] needCorpses;
-    private GameObject spiritObj;           //当前变身的对象
-    public int endChange = 0;               //结束变身后召唤的英灵
-    public Vector2 rightDir;
-
     [Header("玩家组件")]
     public UIHP uiMp;
     private Spirits spirits;
@@ -242,17 +233,6 @@ public class PlayerController : MoveCharacter
     [HideInInspector]
     public bool isKeepBtnRush;
 
-
-    public bool btnTransfiguratePress
-    {
-        get
-        {
-            //return Input.GetKeyDown(KeyCode.L) || isClickBtnEast;
-            return isClickBtnTransfigurate;
-        }
-    }
-    [HideInInspector]
-    public bool isClickBtnTransfigurate;
     public bool btnEastPress
     {
         get
@@ -498,11 +478,6 @@ public class PlayerController : MoveCharacter
                 portalsController.rbs.Remove(rb);
             }
         }
-        if (rightDir.x < -0.5 || rightDir.x > 0.5)
-        {
-            ChangeSpirit();
-        }
-
     }
 
 
@@ -616,31 +591,6 @@ public class PlayerController : MoveCharacter
         }
     }
 
-    //选英灵(手柄右摇杆,小键盘左右)
-    void OnChooseSpirit_LR(InputValue value)
-    {
-        rightDir = value.Get<Vector2>();
-
-    }
-
-    //召唤英灵
-    void OnTransfigurate()
-    {
-        if (!keyTransfigurateRelease && !isFloat && canMove && !isBaseBtnOut)
-        {
-            isClickBtnTransfigurate = true;
-        }
-    }
-
-    //松开变身英灵键
-    void OnTransfigurateUp()
-    {
-        if (!isBaseBtnOut)
-        {
-            keyTransfigurateRelease = true;
-        }
-    }
-
     public void Jump()
     {
         SetUpSpeed(jumpSpeed);
@@ -665,13 +615,9 @@ public class PlayerController : MoveCharacter
 
     public bool CheckSummon()
     {
-        if (btnTransfiguratePress)
+        if (restSummonTime > 0)
         {
-            if (spirits.ultimateTimes[spirits.nowSpirit] > 0)
-            {
-                Summon((int)spirits.ownSpirits[spirits.nowSpirit] + 3);
-                return true;
-            }
+            return false;
         }
         if (state != CharacterState.Conduct && nowConductButton != -1 && conductTime > totalCacheSummonTime)
         {
@@ -1022,12 +968,13 @@ public class PlayerController : MoveCharacter
             //        return true;
             //    }
             //}
-            if (excludeState != CharacterState.Summon)
+            if (CheckSummon())
             {
-                if (CheckSummon())
+                if (excludeState == CharacterState.Summon)
                 {
-                    return true;
+                    ani.Play("summon", 0, 0);
                 }
+                return true;
             }
             if ((btnRushPress || cacheRushTime > 0 || cacheRush) && mp >= rushCostMp)
             {
@@ -1618,9 +1565,6 @@ public class PlayerController : MoveCharacter
         isSpiritSummon1 = false;
         isSpiritSummon2 = false;
         isSpiritSummon3 = false;
-        isClickBtnTransfigurate = false;
-        keyTransfigurateRelease = false;
-
 
         if (foot.TrigGround)
         {
@@ -2136,49 +2080,4 @@ public class PlayerController : MoveCharacter
     {
         targetCharacter = searchTrigger.GetMinDisTarget(attackController.targetTypes, attackController.canHitFly);
     }*/
-
-    public void ChangeSpirit()
-    {
-        if ((playerId == 0 && SpiritSystem.canP1CardChange) || (playerId == 1 && SpiritSystem.canP2CardChange))
-        {
-            if (rightDir.x >= 0.5)
-            {
-
-                switch (playerId)
-                {
-                    case 0:
-                        SpiritSystem.P1CardChangeTime = 0;
-                        SpiritSystem.canP1CardChange = false;
-                        SpiritSystem.isP1CardChangeR = true;
-                        break;
-                    case 1:
-                        SpiritSystem.P2CardChangeTime = 0;
-                        SpiritSystem.canP2CardChange = false;
-                        SpiritSystem.isP2CardChangeR = true;
-                        break;
-                    default:
-                        break;
-                }
-            }
-            else if (rightDir.x <= -0.5)
-            {
-
-                switch (playerId)
-                {
-                    case 0:
-                        SpiritSystem.P1CardChangeTime = 0;
-                        SpiritSystem.canP1CardChange = false;
-                        SpiritSystem.isP1CardChangeL = true;
-                        break;
-                    case 1:
-                        SpiritSystem.P2CardChangeTime = 0;
-                        SpiritSystem.canP2CardChange = false;
-                        SpiritSystem.isP2CardChangeL = true;
-                        break;
-                    default:
-                        break;
-                }
-            }
-        }
-    }
 }