Bladeren bron

空中单位索敌与落地冲突待修改

SZAND\msx_2 11 maanden geleden
bovenliggende
commit
d85eb625c4

+ 118 - 0
ActionTowerDefense/Assets/Resources/Prefab/Conduct/Mountain.prefab

@@ -0,0 +1,118 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &8587706472837483213
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 7312977071883604062}
+  - component: {fileID: 6584883322373862942}
+  - component: {fileID: 2415009481297058421}
+  - component: {fileID: 9182506666843595699}
+  m_Layer: 0
+  m_Name: Mountain
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &7312977071883604062
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8587706472837483213}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 15, y: 5, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 0}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!212 &6584883322373862942
+SpriteRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8587706472837483213}
+  m_Enabled: 1
+  m_CastShadows: 0
+  m_ReceiveShadows: 0
+  m_DynamicOccludee: 1
+  m_StaticShadowCaster: 0
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 0
+  m_RayTraceProcedural: 0
+  m_RenderingLayerMask: 1
+  m_RendererPriority: 0
+  m_Materials:
+  - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
+  m_StaticBatchInfo:
+    firstSubMesh: 0
+    subMeshCount: 0
+  m_StaticBatchRoot: {fileID: 0}
+  m_ProbeAnchor: {fileID: 0}
+  m_LightProbeVolumeOverride: {fileID: 0}
+  m_ScaleInLightmap: 1
+  m_ReceiveGI: 1
+  m_PreserveUVs: 0
+  m_IgnoreNormalsForChartDetection: 0
+  m_ImportantGI: 0
+  m_StitchLightmapSeams: 1
+  m_SelectedEditorRenderState: 0
+  m_MinimumChartSize: 4
+  m_AutoUVMaxDistance: 0.5
+  m_AutoUVMaxAngle: 89
+  m_LightmapParameters: {fileID: 0}
+  m_SortingLayerID: 0
+  m_SortingLayer: 0
+  m_SortingOrder: 0
+  m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
+  m_Color: {r: 0, g: 0.6603774, b: 0.1766994, a: 1}
+  m_FlipX: 0
+  m_FlipY: 0
+  m_DrawMode: 0
+  m_Size: {x: 1, y: 1}
+  m_AdaptiveModeThreshold: 0.5
+  m_SpriteTileMode: 0
+  m_WasSpriteAssigned: 1
+  m_MaskInteraction: 0
+  m_SpriteSortPoint: 0
+--- !u!65 &2415009481297058421
+BoxCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8587706472837483213}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 1
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Size: {x: 1, y: 1, z: 0.2}
+  m_Center: {x: 0, y: 0, z: 0}
+--- !u!114 &9182506666843595699
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8587706472837483213}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 64d01103fae75544a97a5a9d829651a6, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  comaTime: 3
+  comaDamage: 0
+  continueTime: 0
+  pc: {fileID: 0}
+  id: 0

+ 7 - 0
ActionTowerDefense/Assets/Resources/Prefab/Conduct/Mountain.prefab.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: d966b0d5004eaad49b37c963f1aaa584
+PrefabImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

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

@@ -1003,7 +1003,7 @@ MonoBehaviour:
   - 0
   - 0
   - 0
-  conductSkills: 000000000200000000000000
+  conductSkills: 000000000200000003000000
   conductCanRelease: 010101
   conductReadyTip: {fileID: 946637326309089849}
   demonicNum: 
@@ -1011,6 +1011,9 @@ MonoBehaviour:
   photosphereObj: {fileID: 256012001268456902, guid: ba2e5bcb5c7ac604ea72b2fcb544a3cb, type: 3}
   addAttack: 0.2
   attackEffect: {fileID: 417478504669294145, guid: 3b9e1b8087a2c2441a51fff8fec35d4f, type: 3}
+  mountain: {fileID: 8587706472837483213, guid: d966b0d5004eaad49b37c963f1aaa584, type: 3}
+  offset: {x: 0, y: 7, z: 0}
+  mountainTime: 5
   isClickBtnJump: 0
   isClickBtnRush: 0
   isKeepBtnRush: 0

+ 38 - 0
ActionTowerDefense/Assets/Scripts/Conduct/Mountain.cs

@@ -0,0 +1,38 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Mountain : MonoBehaviour
+{
+    public float comaTime;
+    public int comaDamage;
+    public float continueTime;
+    public PlayerController pc;
+    public int id;
+
+    private void Update()
+    {
+        continueTime -= Time.deltaTime;
+        if (continueTime <= 0)
+        {
+            gameObject.SetActive(false);
+            pc.conductCanRelease[id] = true;
+        }
+    }
+
+    private void OnTriggerEnter(Collider other)
+    {
+        if (other.gameObject.layer == 8)
+        {
+            Enemy en = other.GetComponentInParent<Enemy>();
+            if (en.canFly)
+            {
+                en.willBeFly = true;
+                en.canFly = false;
+            }
+            en.ChangeState(CharacterState.Fall);
+            en.willBeComa = true;
+            en.comaDamage = pc.swordNum * 100;
+        }
+    }
+}

+ 11 - 0
ActionTowerDefense/Assets/Scripts/Conduct/Mountain.cs.meta

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

+ 16 - 0
ActionTowerDefense/Assets/Scripts/Enemy.cs

@@ -44,6 +44,12 @@ public class Enemy : MoveCharacter
     private bool hasBeReboundedX;
     private bool hasBeReboundedY;
 
+    [Header("ÂäľŘŃŁÔÎ")]
+    public bool willBeComa;
+    public float willComaTime;
+    public int comaDamage;
+    public bool willBeFly;
+
     [Header("ľĐˇ˝Ó˘Áé")]
     public Spirits.SpiritType type;
 
@@ -413,6 +419,11 @@ public class Enemy : MoveCharacter
                     {
                         ChangeState(CharacterState.FindPlayer);
                     }
+                    else if (willBeComa)
+                    {
+                        comaTime = willComaTime;
+                        ChangeState(CharacterState.Coma);
+                    }
                     else
                     {
                         ChangeState(CharacterState.Idle);
@@ -810,6 +821,11 @@ public class Enemy : MoveCharacter
                 canMove = false;
                 break;
             case CharacterState.Coma:
+                if (willBeComa)
+                {
+                    BeHit(comaDamage, Vector3.zero, false, 0);
+                    canFly = true;
+                }
                 //ani.Play("Coma", 0, 0);
                 ani.Play("idle", 0, 0);
                 aniCollider.Play("Idle", 0, 0);

+ 28 - 1
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -177,13 +177,19 @@ public class PlayerController : MoveCharacter
     //攻击力
     public float addAttack;                 //0-1的小数
     public GameObject attackEffect;
-    
+    //泰山压顶
+    public GameObject mountain;
+    public Vector3 offset;
+    private GameObject curMountain;
+    public float mountainTime;
 
     public enum ConductSkills
     {
         Giant,              //胖子:合成大胖子
         Photosphere,        //胖子:光球
         AddAttack,          //胖子:增加攻击力
+
+        Mountain,           //气功师:泰山压顶
     }
 
 
@@ -681,6 +687,7 @@ public class PlayerController : MoveCharacter
             bool costMp = true; //如果指挥技能要消耗的使魔数量为0就改成false
             switch (conductSkills[cacheConductId])
             {
+                //胖子
                 case ConductSkills.Giant:
                     if (demonicDic[1].Count > 0)
                     {
@@ -777,6 +784,26 @@ public class PlayerController : MoveCharacter
                         costMp = false;
                     }
                     break;
+                //气功师
+                case ConductSkills.Mountain:
+                    if (demonicDic[2].Count > 0)
+                    {
+                        conductCanRelease[cacheConductId] = false;
+                        if (curMountain == null)
+                        {
+                            curMountain= GameObject.Instantiate(mountain, transform);
+                            curMountain.transform.position = transform.position + offset;
+                            curMountain.GetComponent<Mountain>().pc = this;
+                            curMountain.GetComponent<Mountain>().id = cacheConductId;
+                        }
+                        curMountain.SetActive(true);
+                        curMountain.GetComponent<Mountain>().continueTime = mountainTime;
+                    }
+                    else
+                    {
+                        costMp = false;
+                    }
+                    break;
             }
             if (costMp)
             {