瀏覽代碼

漂浮0.9

SZAND\msx_2 1 年之前
父節點
當前提交
5b250c949d

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

@@ -833,10 +833,11 @@ MonoBehaviour:
   hurtChangeVelocity: 1
   maxSpeed: 10
   minSpeed: 2
-  height: 8
+  maxHeight: 10
+  minHeight: 6
   maxRotateSpeed: 10
   minRotateSpeed: 4
-  floatTime: 5
+  floatTime: 20
   demonicPrefabs:
   - {fileID: 8639832132491289359, guid: 4c2987691cdb47040b3a55ff928803c3, type: 3}
   - {fileID: 5440846222648032759, guid: 05825e721b2832f478f66e78daed901f, type: 3}

+ 19 - 7
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -23,16 +23,18 @@ public class MoveCharacter : Character
     public float hurtChangeVelocity = 1;
 
     [Header("新增漂浮效果参数")]
-    public float maxSpeed = 10; //上升最大速度
-    public float minSpeed = 2;  //上升最小速度
-    public float height = 8;    //上升高度
+    public float maxSpeed = 15; //上升最大速度
+    public float minSpeed = 6;  //上升最小速度
+    public float maxHeight = 12;    //最大上升高度
+    public float minHeight = 7;    //最小上升高度
 
-    public float maxRotateSpeed = 10;    //最大旋转速度
-    public float minRotateSpeed = 4;    //最小旋转速度
+    public float maxRotateSpeed;    //最大旋转速度
+    public float minRotateSpeed;    //最小旋转速度
 
-    public float floatTime = 5; //漂浮时间
-    private float curTime;      //漂浮已进行时长
+    public float floatTime = 20;     //漂浮时间
 
+    private float curTime;      //漂浮已进行时长
+    private float height;       //漂浮高度
     private float floatSpeed;   //漂浮速度
     private float curHeight;    //当前所在高度
     private float rotateSpeed;  //旋转速度
@@ -48,6 +50,12 @@ public class MoveCharacter : Character
 
     public void FloatStateOn()
     {
+        maxSpeed = 15; 
+        minSpeed = 6;
+        maxHeight = 9;
+        minHeight = 6;
+
+        floatTime = 20;     
         ChangeState(CharacterState.Rise);
         floatState = 1;
         floatSpeed = Random.Range(minSpeed, maxSpeed);
@@ -56,6 +64,10 @@ public class MoveCharacter : Character
         curTime = 0;
         rotateSpeed = Random.Range(minRotateSpeed, maxRotateSpeed);
         rotateDir = (1.5f - Random.Range(1, 3)) * 2;
+        height = Random.Range(minHeight, maxHeight);
+        print(minHeight);
+        print(maxHeight);
+        print(height);
     }
 
     private void RotateSelf()

+ 0 - 8
ActionTowerDefense/Assets/Scripts/Spirits/Enemy_FloatEffect.cs

@@ -1,8 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class Enemy_FloatEffect : MoveCharacter
-{
-
-}

+ 0 - 11
ActionTowerDefense/Assets/Scripts/Spirits/Enemy_FloatEffect.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 60947c46f140e79428c6774067839ff7
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 39 - 18
ActionTowerDefense/Assets/Scripts/Spirits/Spirits.cs

@@ -13,35 +13,56 @@ public class Spirits : MonoBehaviour
     }
 
     private GameObject floatSpirit;
-    public int currentSpirit = 1;
+    public SpiritType currentSpirit;
 
+    private void disappear()
+    {
+        floatSpirit.SetActive(false);
+    }
 
-    public void SummonSpirit()
+    public void SummonSpirit(SpiritType st)
     {
-        print(floatSpirit);
-        if (floatSpirit == null)
+        switch (st)
         {
-            floatSpirit = GameObject.Find("Capsule").gameObject;
-            print(floatSpirit);
-        }
-        if (floatSpirit.activeSelf)
-        {
-            floatSpirit.SetActive(false);
-        }
-        else
-        {
-            float z = floatSpirit.transform.position.z;
-            floatSpirit.transform.position = new Vector3(transform.position.x, transform.position.y, z);
-            floatSpirit.SetActive(true);
+            case SpiritType.Float:
+                if (floatSpirit == null)
+                {
+                    floatSpirit = GameObject.Find("Capsule").gameObject;
+                }
+                
+                if (floatSpirit.activeSelf)
+                {
+                    floatSpirit.SetActive(false);
+                }
+                else
+                {
+                    float z = floatSpirit.transform.position.z;
+                    floatSpirit.transform.position = new Vector3(transform.position.x, transform.position.y, z);
+                    floatSpirit.SetActive(true);
+                    Invoke("disappear", 0.05f);
+                }
+                break;
+            case SpiritType.Dash:
+                break;
+            case SpiritType.Invisible:
+                break;
+            case SpiritType.Kebab:
+                break;
         }
+
     }
 
     private void Update()
     {
         if (Input.GetKeyDown(KeyCode.P))
         {
-            print(1);
-            SummonSpirit();
+            currentSpirit = SpiritType.Float;
+            SummonSpirit(currentSpirit);
+        }
+        if (Input.GetKeyDown(KeyCode.O))
+        {
+            currentSpirit = SpiritType.Invisible;
+            SummonSpirit(currentSpirit);
         }
     }
 }