SZAND\msx_2 1 жил өмнө
parent
commit
1ef24c6b13

+ 4 - 2
ActionTowerDefense/Assets/Resources/Prefab/Player.prefab

@@ -827,6 +827,7 @@ MonoBehaviour:
   rope: {fileID: 0}
   hasHpUp: 0
   beLarger: 0
+  attackToFloat: 0
   canMove: 1
   foot: {fileID: 3571941039716665623}
   extraRiseGravity: -28.8
@@ -872,7 +873,7 @@ MonoBehaviour:
   - {fileID: 2437299196472462361, guid: 00861cbb6651ced4a85013d35a07b3e6, type: 3}
   - {fileID: 5440846222648032759, guid: 1d487061d2e4ceb409a42daadf985eec, type: 3}
   - {fileID: 2437299196472462361, guid: 0e7e5e45ddc25b641963c78f68b041b8, type: 3}
-  changeTime: 5
+  changeTime: 10
   demonicPrefabs:
   - {fileID: 8639832132491289359, guid: 4c2987691cdb47040b3a55ff928803c3, type: 3}
   - {fileID: 5440846222648032759, guid: 05825e721b2832f478f66e78daed901f, type: 3}
@@ -931,6 +932,7 @@ MonoBehaviour:
   isinputJ: 0
   isinputK: 0
   isinputL: 0
+  moveVec: {x: 0, y: 0}
   isClickBtnJump: 0
   isClickBtnRush: 0
   isKeepBtnRush: 0
@@ -1229,7 +1231,7 @@ MeshRenderer:
   m_AutoUVMaxAngle: 89
   m_LightmapParameters: {fileID: 0}
   m_SortingLayerID: -1730265859
-  m_SortingLayer: 5
+  m_SortingLayer: 4
   m_SortingOrder: 0
   m_AdditionalVertexStreams: {fileID: 0}
 --- !u!95 &6197716555580445942

+ 6 - 1
ActionTowerDefense/Assets/Resources/Prefab/Transfiguration/Trans_Float.prefab

@@ -281,7 +281,7 @@ MeshRenderer:
   m_AutoUVMaxAngle: 89
   m_LightmapParameters: {fileID: 0}
   m_SortingLayerID: -690842069
-  m_SortingLayer: 4
+  m_SortingLayer: 0
   m_SortingOrder: 0
   m_AdditionalVertexStreams: {fileID: 0}
 --- !u!95 &5978259926173120695
@@ -970,6 +970,10 @@ MonoBehaviour:
   controller: {fileID: 0}
   minTime: 7
   maxTime: 9
+  toFloat: 0
+  lockeffect: {fileID: 7959709114612421421, guid: 6d10e54fe2c6a92468d4458f98fea44e, type: 3}
+  fe: {fileID: 417478504669294145, guid: 243eb0eff66414445990654286d861d1, type: 3}
+  keepFloatTime: 5
 --- !u!114 &3290368322717680010
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -1062,6 +1066,7 @@ MonoBehaviour:
   rope: {fileID: 0}
   hasHpUp: 0
   beLarger: 0
+  attackToFloat: 0
   canMove: 1
   foot: {fileID: 8639832132450015562}
   extraRiseGravity: -28.8

+ 16 - 2
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -109,6 +109,8 @@ public class PlayerController : MoveCharacter
     public bool isinputK;
     public bool isinputL;
 
+    public Vector2 moveVec;         //玩家不动时移动数据
+
     public bool btnJumpPress
     {
         get
@@ -369,11 +371,19 @@ public class PlayerController : MoveCharacter
     //读取手柄参数
     private void OnMove(InputValue value)
     {
-        leftDir = value.Get<Vector2>();
+        if (canMove)
+        {
+            leftDir = value.Get<Vector2>();
+        }
+        else
+        {
+            leftDir = Vector3.zero;
+            moveVec= value.Get<Vector2>();
+        }
     }
     void OnJump()
     {
-        if (canJump)
+        if (canJump && canMove)
         {
             isClickBtnJump = true;
         }
@@ -1459,8 +1469,12 @@ public class PlayerController : MoveCharacter
     public void EndTransfiguration(int id)
     {
         isTransfiguration = false;
+        isinputJ = false;
+        isinputK = false;
+        isinputL = false;
         canfly = false;
         canJump = true;
+        canMove = true;
         rb.useGravity = true;
         mecanim = playerMe;
         ani = playerAni;

+ 44 - 6
ActionTowerDefense/Assets/Scripts/Spirits/Trans_Float.cs

@@ -6,17 +6,34 @@ public class Trans_Float : MonoBehaviour
 {
     public PlayerController controller;
 
-    private bool isFirst = true;           //第一次攻击
-    private int times;              //攻击次数
-    public int minTime, maxTime;   //保底范围
+    private bool isFirst = true;            //第一次攻击
+    private int times;                      //攻击次数
+    public int minTime, maxTime;            //保底范围
 
-    public bool toFloat = false;           //攻击触发漂浮
+    public bool toFloat = false;            //攻击触发漂浮
+
+    private bool isK = false;
     private Demonic dem;
 
+    public GameObject lockeffect;           //漂浮特效
+    private GameObject curlock;             //当前漂浮特效
+    public GameObject fe;
+    private GameObject curFe;
+
+    private bool once = false;
+
+    public float keepFloatTime;             //K键最大持续时间
+    private float pastTime;
+
     private void Start()
     {
         controller = GetComponentInParent<PlayerController>();
         dem = GetComponent<Demonic>();
+        controller.canMove = true;
+        curlock = Instantiate(lockeffect, new Vector3(0, -50, 0), new Quaternion(0, 0, 0, 0), null);
+        curFe = Instantiate(fe, curlock.transform.position, new Quaternion(0, 0, 0, 0), null);
+        curlock.SetActive(false);
+        curFe.SetActive(false);
     }
 
     private void Update()
@@ -48,8 +65,29 @@ public class Trans_Float : MonoBehaviour
         }
         if (controller.isinputK)
         {
-            controller.isinputK = false;
-            print(2);
+            pastTime += Time.deltaTime;
+            controller.canMove = false;
+            if (!once)
+            {
+                isK = true;
+                once = true;
+                curlock.transform.position = transform.position;
+                curlock.SetActive(true);
+            }
+            curlock.transform.position += new Vector3(controller.moveVec.x, 0, 0);
+            if (pastTime >= keepFloatTime)
+            {
+                controller.isinputK = false;
+            }
+        }
+        if(isK && !controller.isinputK)
+        {
+            isK = false;
+            controller.canMove = true;
+            once = false;
+            curFe.transform.position = curlock.transform.position;
+            curlock.SetActive(false);
+            curFe.SetActive(true);
         }
         if (controller.isinputL)
         {