فهرست منبع

指挥技能框架

LAPTOP-OM1V99U2\永远de小亡灵 11 ماه پیش
والد
کامیت
1d3fc83718

+ 4 - 4
ActionTowerDefense/Assets/Resources/Prefab/Conduct/Photosphere.prefab

@@ -59,8 +59,8 @@ Transform:
   m_GameObject: {fileID: 1373031044951819773}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
-  m_ConstrainProportionsScale: 0
+  m_LocalScale: {x: 2, y: 2, z: 2}
+  m_ConstrainProportionsScale: 1
   m_Children: []
   m_Father: {fileID: 1639900831015566504}
   m_RootOrder: 0
@@ -157,9 +157,9 @@ CapsuleCollider:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 5080240558872983884}
   m_Material: {fileID: 0}
-  m_IsTrigger: 0
+  m_IsTrigger: 1
   m_Enabled: 1
-  m_Radius: 0.5
+  m_Radius: 1
   m_Height: 20
   m_Direction: 2
   m_Center: {x: 0, y: 0, z: 0}

+ 133 - 0
ActionTowerDefense/Assets/Resources/Prefab/Conduct/conductReady.prefab

@@ -0,0 +1,133 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &256012001268456902
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1639900831015566504}
+  - component: {fileID: 653345970205402394}
+  m_Layer: 0
+  m_Name: conductReady
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &1639900831015566504
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 256012001268456902}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children:
+  - {fileID: 8283194513254342148}
+  m_Father: {fileID: 0}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &653345970205402394
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 256012001268456902}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: efc3c75c4c266ef488ed0a1ba33a2910, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  isShowing: 0
+  sprite: {fileID: 8894579418163447399}
+--- !u!1 &1373031044951819773
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 8283194513254342148}
+  - component: {fileID: 8894579418163447399}
+  m_Layer: 0
+  m_Name: Sprite
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &8283194513254342148
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1373031044951819773}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 1639900831015566504}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!212 &8894579418163447399
+SpriteRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1373031044951819773}
+  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: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3}
+  m_Color: {r: 1, g: 1, b: 1, 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

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

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

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

@@ -747,6 +747,7 @@ Transform:
   - {fileID: 2788556811231999033}
   - {fileID: 1969773273}
   - {fileID: 5703294785992921468}
+  - {fileID: 1364623729279974283}
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -991,11 +992,13 @@ MonoBehaviour:
   - 1
   - 1
   - 1
+  conductCostMp:
+  - 0
+  - 0
+  - 0
   conductSkills: 000000000000000000000000
-  condectImportList:
-  - {fileID: 0}
-  - {fileID: 0}
-  - {fileID: 0}
+  conductReadyTip: {fileID: 946637326309089849}
+  photosphereObj: {fileID: 256012001268456902, guid: ba2e5bcb5c7ac604ea72b2fcb544a3cb, type: 3}
   isClickBtnJump: 0
   isClickBtnRush: 0
   isKeepBtnRush: 0
@@ -1760,6 +1763,79 @@ Transform:
   m_Father: {fileID: 5205406772191310031}
   m_RootOrder: 7
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1001 &302311904116852515
+PrefabInstance:
+  m_ObjectHideFlags: 0
+  serializedVersion: 2
+  m_Modification:
+    m_TransformParent: {fileID: 3571941038519084349}
+    m_Modifications:
+    - target: {fileID: 256012001268456902, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_Name
+      value: conductReady
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_RootOrder
+      value: 3
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 0.07
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: 1.57
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalRotation.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalRotation.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalRotation.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.z
+      value: 0
+      objectReference: {fileID: 0}
+    m_RemovedComponents: []
+  m_SourcePrefab: {fileID: 100100000, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+--- !u!114 &946637326309089849 stripped
+MonoBehaviour:
+  m_CorrespondingSourceObject: {fileID: 653345970205402394, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+  m_PrefabInstance: {fileID: 302311904116852515}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 0}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: efc3c75c4c266ef488ed0a1ba33a2910, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+--- !u!4 &1364623729279974283 stripped
+Transform:
+  m_CorrespondingSourceObject: {fileID: 1639900831015566504, guid: 00e0f54f92bab0e4f8e42b1550fc8955, type: 3}
+  m_PrefabInstance: {fileID: 302311904116852515}
+  m_PrefabAsset: {fileID: 0}
 --- !u!1001 &1290486754801983368
 PrefabInstance:
   m_ObjectHideFlags: 0

+ 37 - 0
ActionTowerDefense/Assets/Scripts/Conduct/ConductReadyTip.cs

@@ -0,0 +1,37 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConductReadyTip : MonoBehaviour
+{
+    private bool isShowing;
+    public SpriteRenderer sprite;
+    private float time;
+    // Start is called before the first frame update
+    void Start()
+    {
+        sprite.enabled = false;
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        if (isShowing)
+        {
+            time -= Time.deltaTime;
+            sprite.color = new Color(1, 1, 1, time);
+            if(time <= 0)
+            {
+                sprite.enabled = false;
+                isShowing = false;
+            }
+        }
+    }
+    public void Show()
+    {
+        time = 1;
+        sprite.enabled = true;
+        sprite.color = new Color(1, 1, 1, 1);
+        isShowing = true;
+    }
+}

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

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

+ 58 - 7
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -155,10 +155,16 @@ public class PlayerController : MoveCharacter
     //指挥功能
     private float conductTime;          //指挥按键长按时间
     private int nowConductButton = -1;     //现在按下的指挥键(0.J/1.K/2.L/-1.无)
+    private int cacheCouductId;
     [Header("召唤相应时间")] [Tooltip("在此时间内松手为召唤")] public float totalCacheSummonTime = 0.1f;
     [Header("指挥相应时间")] [Tooltip("在此时间以外松手为指挥")] public float[] canConductTime;
+    [Header("指挥相应耗蓝")] [Tooltip("输入相应的技能耗蓝")] public float[] conductCostMp;
     [Header("指挥技能")] [Tooltip("选择相应的指挥技能")] public ConductSkills[] conductSkills;
-    public GameObject[] condectImportList;  //用于指挥技能的预制体调用
+    public ConductReadyTip conductReadyTip; //指挥技就绪
+    private bool isReadyConduct;
+    public GameObject photosphereObj;
+    
+
     public enum ConductSkills
     {
         Photosphere,
@@ -495,6 +501,7 @@ public class PlayerController : MoveCharacter
         if(nowConductButton == 0)
         {
             isBtnWestUp = true;
+            cacheCouductId = nowConductButton;
             nowConductButton = -1;
         }
     }
@@ -514,6 +521,7 @@ public class PlayerController : MoveCharacter
         if (nowConductButton == 1)
         {
             isBtnSouthUp = true;
+            cacheCouductId = nowConductButton;
             nowConductButton = -1;
         }
     }
@@ -533,6 +541,7 @@ public class PlayerController : MoveCharacter
         if (nowConductButton == 2)
         {
             isBtnEastUp = true;
+            cacheCouductId = nowConductButton;
             nowConductButton = -1;
         }
     }
@@ -602,6 +611,12 @@ public class PlayerController : MoveCharacter
 
     public bool CheckSummon()
     {
+        if (state!=CharacterState.Conduct && nowConductButton != -1 && conductTime >= 0)
+        {
+            CheckTurn();
+            ChangeState(CharacterState.Conduct);
+            return true;
+        }
         if (isBtnEastUp || isBtnWestUp || isBtnSouthUp)
         {
             if (cacheSummonTime >= 0 && conductTime <= totalCacheSummonTime)
@@ -622,24 +637,48 @@ public class PlayerController : MoveCharacter
                 return true;
             }
         }
-        if (nowConductButton != -1 && conductTime >= totalCacheSummonTime)
-        {
-            CheckTurn();
-            ChangeState(CharacterState.Conduct);
-            return true;
-        }
         return false;
     }
 
     public bool CheckConduct()
     {
+        if(!isReadyConduct && conductTime >= canConductTime[nowConductButton])
+        {
+            conductReadyTip.Show();
+            isReadyConduct = true;
+        }
         if (isBtnEastUp || isBtnWestUp || isBtnSouthUp)
         {
+            if (isReadyConduct)
+            {
+                Conduct();
+            }
+            isReadyConduct = false;
             return true;
         }
         return false;
     }
 
+    public void Conduct()
+    {
+        if (mp >= conductCostMp[cacheCouductId])
+        {
+            mp -= conductCostMp[cacheCouductId];
+            uiMp.Show(mp, totalMp);
+            switch (conductSkills[cacheCouductId])
+            {
+                case ConductSkills.Photosphere:
+
+                    GameObject obj = GameObject.Instantiate(photosphereObj,transform);
+                    obj.transform.position = transform.position + Vector3.up;
+                    break;
+            }
+        }
+        else
+        {
+            print("蓝量不足");
+        }
+    }
     //角色处于可自由活动状态时的通用切换状态逻辑,如Idle、Run状态,以及别的状态结束时准备回到Idle状态前
     public bool CheckPlayerChangeState(CharacterState excludeState = CharacterState.None)
     {
@@ -1306,10 +1345,16 @@ public class PlayerController : MoveCharacter
 
                 break;
             case CharacterState.Conduct:
+                if (CheckSummon())
+                {
+                    break;
+                }
                 if (CheckConduct())
                 {
                     ChangeState(CharacterState.Idle);
                 }
+
+
                 break;
             default:
                 break;
@@ -1522,6 +1567,9 @@ public class PlayerController : MoveCharacter
             case CharacterState.Weak:
                 beRepelValue = totalBeRepelValue;
                 break;
+            case CharacterState.Conduct:
+                rb.isKinematic =false;
+                break;
             default:
                 break;
         }
@@ -1637,6 +1685,9 @@ public class PlayerController : MoveCharacter
                 break;
             case CharacterState.Conduct:
                 rb.velocity = Vector3.zero;
+                rb.isKinematic = true;
+                aniCollider.Play("Summon", 0, 0);
+                ani.Play("summon", 0, 0);
                 break;
             default:
                 break;