Ver código fonte

敌方法师功能基本没问题了

SZAND\msx_2 1 ano atrás
pai
commit
1aff79d97d

+ 3 - 1
ActionTowerDefense/Assets/Resources/Prefab/ESpirits_Float.prefab

@@ -964,6 +964,7 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   height: 7
   intervalTime: 20
+  firstAttackTime: 2
   followTime: 3
   lockTime: 3
   fe: {fileID: 417478504669294145, guid: 243eb0eff66414445990654286d861d1, type: 3}
@@ -1011,7 +1012,7 @@ MonoBehaviour:
   isNonAttack: 0
   hptp: 0
   isDie: 0
-  totalHp: 100
+  totalHp: 5000
   hp: 0
   attack1Infos:
   - damage: 10
@@ -1077,6 +1078,7 @@ MonoBehaviour:
   maxRotateSpeed: 20
   minRotateSpeed: 5
   floatTime: 20
+  floatState: 0
   outlineMats:
   - {fileID: 2100000, guid: b89f4b5b01e92784ab27611e2b014a10, type: 2}
   - {fileID: 2100000, guid: 0d24ea357a09df448b788aed95b96541, type: 2}

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

@@ -841,8 +841,10 @@ MonoBehaviour:
   minHeight: 4
   maxRotateSpeed: 20
   minRotateSpeed: 5
-  floatTime: 20
-  outlineMats: []
+  floatTime: 5
+  floatState: 0
+  outlineMats:
+  - {fileID: 2100000, guid: 81069b2e594d94340983febc6c5ff9b3, type: 2}
   demonicPrefabs:
   - {fileID: 8639832132491289359, guid: 4c2987691cdb47040b3a55ff928803c3, type: 3}
   - {fileID: 5440846222648032759, guid: 05825e721b2832f478f66e78daed901f, type: 3}

+ 43 - 0
ActionTowerDefense/Assets/Resources/Spine/king_devil/king_deil_Material_Outline.mat

@@ -0,0 +1,43 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+  serializedVersion: 8
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_Name: king_deil_Material_Outline
+  m_Shader: {fileID: 4800000, guid: 28b5cf4804845fe4b868531fd0bb81d5, type: 3}
+  m_ValidKeywords:
+  - _USE8NEIGHBOURHOOD_ON
+  m_InvalidKeywords: []
+  m_LightmapFlags: 4
+  m_EnableInstancingVariants: 0
+  m_DoubleSidedGI: 0
+  m_CustomRenderQueue: -1
+  stringTagMap: {}
+  disabledShaderPasses: []
+  m_SavedProperties:
+    serializedVersion: 3
+    m_TexEnvs:
+    - _MainTex:
+        m_Texture: {fileID: 2800000, guid: b90ffb66ffe9aee46a8cb054e932abd4, type: 3}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    m_Ints: []
+    m_Floats:
+    - _Cutoff: 0.1
+    - _OutlineMipLevel: 0
+    - _OutlineOpaqueAlpha: 1
+    - _OutlineReferenceTexWidth: 1024
+    - _OutlineSmoothness: 1
+    - _OutlineWidth: 8
+    - _StencilComp: 8
+    - _StencilRef: 1
+    - _StraightAlphaInput: 0
+    - _ThresholdEnd: 0.25
+    - _Use8Neighbourhood: 1
+    m_Colors:
+    - _OutlineColor: {r: 0, g: 0.9890747, b: 1, a: 1}
+  m_BuildTextureStacks: []

+ 8 - 0
ActionTowerDefense/Assets/Resources/Spine/king_devil/king_deil_Material_Outline.mat.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 81069b2e594d94340983febc6c5ff9b3
+NativeFormatImporter:
+  externalObjects: {}
+  mainObjectFileID: 2100000
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 30 - 22
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -83,6 +83,12 @@ public class MoveCharacter : Character
     public void FloatStateOn()
     {
         ChangeMat(0);
+        curTime = 0;
+        if (floatState == 0)
+        {
+            origPos = transform.position;
+            curHeight = origPos.y;
+        }
         ChangeState(CharacterState.Rise);
         floatState = 1;
         riseTime = Random.Range(minTime, maxTime);
@@ -91,9 +97,6 @@ public class MoveCharacter : Character
         {
             backSpeed = -backSpeed;
         }
-        origPos = transform.position;
-        curHeight = origPos.y;
-        curTime = 0;
         rotateSpeed = Random.Range(minRotateSpeed, maxRotateSpeed);
         rotateDir = (1.5f - Random.Range(1, 3)) * 2;
         height = Random.Range(minHeight, maxHeight);
@@ -104,14 +107,8 @@ public class MoveCharacter : Character
         transform.localEulerAngles += new Vector3(0, 0, 1) * rotateDir * rotateSpeed * Time.deltaTime;
     }
 
-
-    public void Update()
+    public void CharacterFloat()
     {
-        if (beLarger)
-        {
-            Enlarge();
-        }
-        //print(maxTime);
         if (floatState == 1)
         {
             RotateSelf();
@@ -123,27 +120,30 @@ public class MoveCharacter : Character
             {
                 floatState = 2;
                 pastTime = curTime;
+                height = transform.position.y;
                 ChangeState(CharacterState.Float);
-                transform.position = new Vector3(origPos.x, height, origPos.z);
             }
         }
         else if (floatState == 2)
         {
             RotateSelf();
             curTime += Time.deltaTime;
-            origPos.x += backSpeed * (curTime - pastTime);
-            transform.position = new Vector3(origPos.x, height, origPos.z);
+            transform.position = new Vector3(origPos.x + backSpeed * (curTime - pastTime), height, origPos.z);
             if (curTime >= floatTime)
             {
-                floatState = 3;
-                ChangeState(CharacterState.Fall);
+                transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(0, 0, 0), 0.02f);
+                if (transform.localEulerAngles.z >= -5f && transform.localEulerAngles.z <= 5f)
+                {
+                    transform.localEulerAngles = new Vector3(0, 0, 0);
+                    floatState = 3;
+                    origPos.x = transform.position.x;
+                    ChangeState(CharacterState.Fall);
+                }
             }
         }
         else if (floatState == 3)
         {
-            RotateSelf();
             aniCollider.Play("Fall", 0, 0);
-
             if (transform.position.y >= origPos.y + 0.05f)
             {
                 curHeight -= 10 * Time.deltaTime;
@@ -157,11 +157,6 @@ public class MoveCharacter : Character
                 foreach (Material m in mats)
                 {
                     m.SetInt("_Outline", 0);
-                }
-                transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(0, 0, 0), 0.02f);
-                if (transform.localEulerAngles.z >= -5f && transform.localEulerAngles.z <= 5f)
-                {
-                    transform.localEulerAngles = new Vector3(0, 0, 0);
                     floatState = 0;
                     if (gameObject.tag == "Player")
                     {
@@ -172,6 +167,19 @@ public class MoveCharacter : Character
         }
     }
 
+
+    public void Update()
+    {
+        if (beLarger)
+        {
+            Enlarge();
+        }
+        if (floatState != 0)
+        {
+            CharacterFloat();
+        }
+    }
+
     public override void BeHit(int damage, Vector3 force, bool changeHurt, float repelValue)
     {
         print("MoveCharacterBeHit");

+ 3 - 3
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -322,7 +322,7 @@ public class PlayerController : MoveCharacter
         }
         if (floatState != 0)
         {
-            base.Update();
+            CharacterFloat();
         }
     }
 
@@ -1020,7 +1020,7 @@ public class PlayerController : MoveCharacter
         SearchTarget();
         attackTarget = targetCharacter;
 
-        if (state != CharacterState.Float)
+        if (floatState == 0)
         {
             if (mp < totalMp)
             {
@@ -1035,8 +1035,8 @@ public class PlayerController : MoveCharacter
         {
             if (mp > 0)
             {
-                mp -= mpReplySpeed * Time.deltaTime;
                 lostMp += mpReplySpeed * Time.deltaTime;
+                mp -= mpReplySpeed * Time.deltaTime;   
             }
             if (mp < 0)
             {

+ 4 - 1
ActionTowerDefense/Assets/Scripts/Spirits/ESpirits_Float.cs

@@ -84,7 +84,10 @@ public class ESpirits_Float : MonoBehaviour
 
     private void FollowPlayer()
     {
-        curLock.transform.position = target.transform.position;
+        if (target != null)
+        {
+            curLock.transform.position = target.transform.position;
+        }
     }
 
     private void LockPlayer()

+ 0 - 1
ActionTowerDefense/Assets/Scripts/Spirits/FloatEffect.cs

@@ -35,7 +35,6 @@ public class FloatEffect : MonoBehaviour
         else if(isEnemy && other.gameObject.layer == 6)
         {
             GameObject ga = other.transform.parent.parent.parent.gameObject;
-            print(1);
             ga.GetComponent<PlayerController>().lostMp = 0;
             ga.GetComponent<PlayerController>().soulCollector.enabled = false;
             ga.GetComponent<PlayerController>().FloatStateOn();