Forráskód Böngészése

变身后可飞行,隐身状态长按k释放烟雾

LAPTOP-OM1V99U2\永远de小亡灵 1 éve
szülő
commit
04fc73def5

+ 93 - 0
ActionTowerDefense/Assets/Resources/Actions/Player.inputactions

@@ -50,6 +50,15 @@
                     "interactions": "",
                     "initialStateCheck": false
                 },
+                {
+                    "name": "Summon0Up",
+                    "type": "Button",
+                    "id": "e6d7ac1d-51d0-41da-925a-81ccc0e655a1",
+                    "expectedControlType": "Button",
+                    "processors": "",
+                    "interactions": "Press(behavior=1)",
+                    "initialStateCheck": false
+                },
                 {
                     "name": "Summon1",
                     "type": "Button",
@@ -59,6 +68,15 @@
                     "interactions": "",
                     "initialStateCheck": false
                 },
+                {
+                    "name": "Summon1Up",
+                    "type": "Button",
+                    "id": "c53e35d4-5ab9-4b18-8df0-0b9d45cf2041",
+                    "expectedControlType": "Button",
+                    "processors": "",
+                    "interactions": "Press(behavior=1)",
+                    "initialStateCheck": false
+                },
                 {
                     "name": "Summon2",
                     "type": "Button",
@@ -68,6 +86,15 @@
                     "interactions": "",
                     "initialStateCheck": false
                 },
+                {
+                    "name": "Summon2Up",
+                    "type": "Button",
+                    "id": "d687dadc-ecee-4b20-a885-85e173d13f10",
+                    "expectedControlType": "Button",
+                    "processors": "",
+                    "interactions": "Press(behavior=1)",
+                    "initialStateCheck": false
+                },
                 {
                     "name": "SummonSpirit",
                     "type": "Button",
@@ -391,6 +418,72 @@
                     "action": "SummonSpirit3",
                     "isComposite": false,
                     "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "d9443439-0988-4bd5-b534-f3f2c2fcfb50",
+                    "path": "<Gamepad>/buttonNorth",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon1Up",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "8760dfea-aae0-47ef-a322-08120d959e9e",
+                    "path": "<Keyboard>/k",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon1Up",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "1ad64ed7-9c90-42c9-b22f-0304c0cd56cb",
+                    "path": "<Gamepad>/buttonEast",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon2Up",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "8468fd48-caca-49d6-8347-85b9a1e7f6fc",
+                    "path": "<Keyboard>/l",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon2Up",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "63d06e39-9968-4072-b53b-e5be886e51a1",
+                    "path": "<Gamepad>/buttonWest",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon0Up",
+                    "isComposite": false,
+                    "isPartOfComposite": false
+                },
+                {
+                    "name": "",
+                    "id": "7f35c767-dfbb-456e-ab81-d41b7a05b55b",
+                    "path": "<Keyboard>/j",
+                    "interactions": "",
+                    "processors": "",
+                    "groups": "",
+                    "action": "Summon0Up",
+                    "isComposite": false,
+                    "isPartOfComposite": false
                 }
             ]
         }

+ 147 - 0
ActionTowerDefense/Assets/Resources/Prefab/FX/SmokeEffect.prefab

@@ -0,0 +1,147 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &6196221395310242246
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 2436416521288021759}
+  - component: {fileID: 7112444601151804775}
+  m_Layer: 0
+  m_Name: Circle
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &2436416521288021759
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 6196221395310242246}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 3, y: 3, z: 3}
+  m_ConstrainProportionsScale: 1
+  m_Children: []
+  m_Father: {fileID: 7473170563405908937}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!212 &7112444601151804775
+SpriteRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 6196221395310242246}
+  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
+--- !u!1 &7473170563405908938
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 7473170563405908937}
+  - component: {fileID: 5057362010940752532}
+  - component: {fileID: 2039446804940946572}
+  m_Layer: 0
+  m_Name: SmokeEffect
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &7473170563405908937
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7473170563405908938}
+  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: 2436416521288021759}
+  m_Father: {fileID: 0}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!135 &5057362010940752532
+SphereCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7473170563405908938}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 1
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Radius: 1.5
+  m_Center: {x: 0, y: 0, z: 0}
+--- !u!114 &2039446804940946572
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7473170563405908938}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: f9ea33d7b291eab41aa2e0440552b65d, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  stayTime: 0
+  time: 0

+ 7 - 0
ActionTowerDefense/Assets/Resources/Prefab/FX/SmokeEffect.prefab.meta

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

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

@@ -866,6 +866,7 @@ MonoBehaviour:
   playerMesh: {fileID: 0}
   playerMats: []
   playerOut: []
+  isInvisible: 0
   changePrefabs:
   - {fileID: 8639832132491289359, guid: b924426f768fd34418c3332de33d391a, type: 3}
   - {fileID: 2437299196472462361, guid: 00861cbb6651ced4a85013d35a07b3e6, type: 3}
@@ -947,7 +948,8 @@ MonoBehaviour:
   playerSpine:
   - {fileID: 11400000, guid: a1915b92abea4a049a4d50b2ebd53111, type: 2}
   - {fileID: 11400000, guid: b8dcb564f1b91234588d66173ce4064e, type: 2}
-  isInvisible: 0
+  canJump: 1
+  canfly: 0
   LBisHold: 0
 --- !u!54 &3571941038519084339
 Rigidbody:

+ 5 - 0
ActionTowerDefense/Assets/Resources/Prefab/Transfiguration/Trans_Invisible.prefab

@@ -214,6 +214,11 @@ MonoBehaviour:
   body: {fileID: 2730232521377132808}
   shootPos: {fileID: 7644101665628300234}
   soulFollowEffect: {fileID: 4610496197409361392}
+  smokeEffect: {fileID: 7473170563405908938, guid: 47ae7a5205468ad4192060c7b1f3e9c2, type: 3}
+  interval: 0.1
+  lastSmokePos: {x: 0, y: 0, z: 0}
+  time: 0
+  stayTime: 5
 --- !u!114 &2437299196472462353
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 6 - 0
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -71,6 +71,7 @@ public class MoveCharacter : Character
     public MeshRenderer playerMesh;
     public Material[] playerMats;
     public Material[] playerOut;
+    public bool isInvisible;
 
     private void Awake()
     {
@@ -216,10 +217,15 @@ public class MoveCharacter : Character
 
     public override void BeHit(int damage, Vector3 force, bool changeHurt, float repelValue)
     {
+        if (isInvisible)
+        {
+            return;
+        }
         if (invincibleTime > 0)
         {
             return;
         }
+
         hp -= damage;
         uiHp.Show(hp, totalHp);
         if (hp <= 0)

+ 87 - 20
ActionTowerDefense/Assets/Scripts/PlayerController.cs

@@ -234,7 +234,8 @@ public class PlayerController : MoveCharacter
     public int playerId;
     public SkeletonMecanim skeletonMecanim;
     public SkeletonDataAsset[] playerSpine;
-    public bool isInvisible;
+    public bool canJump;
+    public bool canfly;
     //public Vector2 leftDir
     //{
     //    get
@@ -368,7 +369,11 @@ public class PlayerController : MoveCharacter
     }
     void OnJump()
     {
-        isClickBtnJump = true;
+        if (canJump)
+        {
+            isClickBtnJump = true;
+        }
+        
     }
     void OnSummon0()
     {
@@ -378,6 +383,13 @@ public class PlayerController : MoveCharacter
             isinputJ = true;
         }
     }
+    void OnSummon0Up()
+    {
+        if (isTransfiguration)
+        {
+            isinputJ = false;
+        }
+    }
     void OnSummon1()
     {
         isClickBtnSouth = true;
@@ -386,6 +398,13 @@ public class PlayerController : MoveCharacter
             isinputK = true;
         }
     }
+    void OnSummon1Up()
+    {
+        if (isTransfiguration)
+        {
+            isinputK = false;
+        }
+    }
     void OnSummon2()
     {
         isClickBtnEast = true;
@@ -394,6 +413,13 @@ public class PlayerController : MoveCharacter
             isinputL = true;
         }
     }
+    void OnSummon2Up()
+    {
+        if (isTransfiguration)
+        {
+            isinputL = false;
+        }
+    }
     void OnSummonSpirit()
     {
         isSpiritSummon = true;
@@ -561,22 +587,47 @@ public class PlayerController : MoveCharacter
                     return true;
                 }
             }
-            if (leftDir.x > 0.3f || leftDir.x < -0.3f)
+            if (canfly)
             {
-                if (excludeState != CharacterState.Run)
+                if (leftDir.x > 0.3f || leftDir.x < -0.3f || leftDir.y>0.3f||leftDir.y<-0.3f)
                 {
-                    ChangeState(CharacterState.Run);
-                    return true;
+                    if (excludeState != CharacterState.Run)
+                    {
+                        ChangeState(CharacterState.Run);
+                        return true;
+                    }
+                }
+                else
+                {
+                    if (excludeState != CharacterState.Idle)
+                    {
+                        ChangeState(CharacterState.Idle);
+                        return true;
+                    }
                 }
             }
             else
             {
-                if (excludeState != CharacterState.Idle)
+                if (leftDir.x > 0.3f || leftDir.x < -0.3f)
                 {
-                    ChangeState(CharacterState.Idle);
-                    return true;
+                    if (excludeState != CharacterState.Run)
+                    {
+                        ChangeState(CharacterState.Run);
+                        return true;
+                    }
+                }
+                else
+                {
+                    if (excludeState != CharacterState.Idle)
+                    {
+                        ChangeState(CharacterState.Idle);
+                        return true;
+                    }
                 }
+
             }
+
+
         }
         return false;
     }
@@ -669,14 +720,22 @@ public class PlayerController : MoveCharacter
                     break;
                 }
                 CheckTurn();
-                if (leftDir.x > 0.3f)
+                if (canfly)
                 {
-                    rb.velocity = Vector3.right * moveSpeed;
+                    rb.velocity = leftDir.normalized * moveSpeed;
                 }
-                else if (leftDir.x < -0.3f)
+                else
                 {
-                    rb.velocity = Vector3.left * moveSpeed;
+                    if (leftDir.x > 0.3f)
+                    {
+                        rb.velocity = Vector3.right * moveSpeed;
+                    }
+                    else if (leftDir.x < -0.3f)
+                    {
+                        rb.velocity = Vector3.left * moveSpeed;
+                    }
                 }
+
                 break;
             case CharacterState.Rise:
                 if (CheckSummon())
@@ -1282,18 +1341,26 @@ public class PlayerController : MoveCharacter
     public Vector3 AirMove(Vector3 velocity)
     {
         CheckTurn();
-        if (leftDir.x > 0.3f)
+        if (canfly)
         {
-            velocity = new Vector3(moveSpeed, velocity.y, velocity.z);
-        }
-        else if (leftDir.x < -0.3f)
-        {
-            velocity = new Vector3(-moveSpeed, velocity.y, velocity.z);
+            velocity = leftDir.normalized * moveSpeed;
         }
         else
         {
-            velocity = new Vector3(0, velocity.y, velocity.z);
+            if (leftDir.x > 0.3f)
+            {
+                velocity = new Vector3(moveSpeed, velocity.y, velocity.z);
+            }
+            else if (leftDir.x < -0.3f)
+            {
+                velocity = new Vector3(-moveSpeed, velocity.y, velocity.z);
+            }
+            else
+            {
+                velocity = new Vector3(0, velocity.y, velocity.z);
+            }
         }
+
         return velocity;
     }
 

+ 19 - 0
ActionTowerDefense/Assets/Scripts/Spirits/SmokeDestroy.cs

@@ -0,0 +1,19 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class SmokeDestroy : MonoBehaviour
+{
+    [HideInInspector]
+    public float stayTime;
+    [HideInInspector]
+    public float time;
+    private void Update()
+    {
+        time += Time.deltaTime;
+        if(time >= stayTime)
+        {
+            gameObject.SetActive(false);
+        }
+    }
+}

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

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

+ 26 - 1
ActionTowerDefense/Assets/Scripts/Spirits/Spirits_Invisible.cs

@@ -17,6 +17,14 @@ public class Spirits_Invisible : MonoBehaviour
     public Transform body;
     public Transform shootPos;
     public SoulFollowEffect soulFollowEffect;
+    public GameObject smokeEffect;
+    public float interval;
+    [HideInInspector]
+    public Vector3 lastSmokePos;
+    [HideInInspector]
+    public float time;
+    public float stayTime;
+
     private void Start()
     {
         
@@ -24,7 +32,7 @@ public class Spirits_Invisible : MonoBehaviour
         playerController = player.GetComponent<PlayerController>();
         playerController.isInvisible = true;
         playerController.mp += addMp;
-
+        playerController.canfly = true;
         for(int i = 0;i < playerController.beTargetCharacter.Count; i++)
         {
             playerController.beTargetCharacter[i].targetCharacter = null;
@@ -47,6 +55,23 @@ public class Spirits_Invisible : MonoBehaviour
             }
             
         }
+        if (playerController.isClickBtnSouth)
+        {
+            time = 0;
+        }
+        if (playerController.isinputK)
+        {
+            time += Time.deltaTime;
+            if (time > interval)
+            {
+                GameObject smoke = Instantiate(smokeEffect);
+                smoke.transform.position = transform.position;
+                smoke.GetComponent<SmokeDestroy>().stayTime = stayTime;
+                lastSmokePos = transform.position;
+                time = 0;
+            }
+            
+        }
     }
     public void BackToPlayer()
     {