wulifu 1 жил өмнө
parent
commit
bdd342bd5e

+ 4 - 0
ActionTowerDefense/Assets/Resources/Prefab/Enemy_Arrow.prefab

@@ -1026,6 +1026,10 @@ MonoBehaviour:
   attackRatio: 0
   maxMoveSpeed: 2.2
   minMoveSpeed: 1.8
+  dropSoul: 3
+  soulPrefab: {fileID: 1723151111827507807, guid: e2b65aa482f2f1447a4074208d72b778, type: 3}
+  soulStartSpeed: 8
+  dropSoulAngle: 30
 --- !u!54 &8639832132491289349
 Rigidbody:
   m_ObjectHideFlags: 0

+ 4 - 0
ActionTowerDefense/Assets/Resources/Prefab/Enemy_Giant.prefab

@@ -479,6 +479,10 @@ MonoBehaviour:
   attackRatio: 0
   maxMoveSpeed: 1.2
   minMoveSpeed: 0.8
+  dropSoul: 10
+  soulPrefab: {fileID: 1723151111827507807, guid: e2b65aa482f2f1447a4074208d72b778, type: 3}
+  soulStartSpeed: 12
+  dropSoulAngle: 30
 --- !u!54 &5440846222648032765
 Rigidbody:
   m_ObjectHideFlags: 0

+ 4 - 0
ActionTowerDefense/Assets/Resources/Prefab/Enemy_Sword.prefab

@@ -274,6 +274,10 @@ MonoBehaviour:
   attackRatio: 0
   maxMoveSpeed: 2
   minMoveSpeed: 1.6
+  dropSoul: 5
+  soulPrefab: {fileID: 1723151111827507807, guid: e2b65aa482f2f1447a4074208d72b778, type: 3}
+  soulStartSpeed: 10
+  dropSoulAngle: 30
 --- !u!54 &2437299196472462355
 Rigidbody:
   m_ObjectHideFlags: 0

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 280 - 198
ActionTowerDefense/Assets/Resources/Prefab/soul.prefab


+ 1 - 1
ActionTowerDefense/Assets/Resources/Prefab/soul.prefab.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 92f62c6a97f17ea4cb304325714c822e
+guid: e2b65aa482f2f1447a4074208d72b778
 PrefabImporter:
   externalObjects: {}
   userData: 

+ 7 - 104
ActionTowerDefense/Assets/Scenes/SampleScene.unity

@@ -135,7 +135,7 @@ GameObject:
   - component: {fileID: 43346116}
   - component: {fileID: 43346115}
   - component: {fileID: 43346114}
-  m_Layer: 0
+  m_Layer: 3
   m_Name: Cube (1)
   m_TagString: Plane
   m_Icon: {fileID: 0}
@@ -411,7 +411,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 585662581}
-  m_Layer: 0
+  m_Layer: 3
   m_Name: TestGround
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -451,7 +451,7 @@ GameObject:
   - component: {fileID: 1360535230}
   - component: {fileID: 1360535229}
   - component: {fileID: 1360535228}
-  m_Layer: 0
+  m_Layer: 3
   m_Name: Cube (2)
   m_TagString: Plane
   m_Icon: {fileID: 0}
@@ -548,7 +548,7 @@ GameObject:
   - component: {fileID: 1500161234}
   - component: {fileID: 1500161233}
   - component: {fileID: 1500161232}
-  m_Layer: 0
+  m_Layer: 3
   m_Name: Cube
   m_TagString: Plane
   m_Icon: {fileID: 0}
@@ -645,7 +645,7 @@ GameObject:
   - component: {fileID: 1687725002}
   - component: {fileID: 1687725001}
   - component: {fileID: 1687725000}
-  m_Layer: 0
+  m_Layer: 3
   m_Name: Cube
   m_TagString: Plane
   m_Icon: {fileID: 0}
@@ -801,7 +801,7 @@ GameObject:
   - component: {fileID: 2045679348}
   - component: {fileID: 2045679347}
   - component: {fileID: 2045679346}
-  m_Layer: 0
+  m_Layer: 3
   m_Name: Cube (4)
   m_TagString: Plane
   m_Icon: {fileID: 0}
@@ -898,7 +898,7 @@ GameObject:
   - component: {fileID: 2111188097}
   - component: {fileID: 2111188096}
   - component: {fileID: 2111188095}
-  m_Layer: 0
+  m_Layer: 3
   m_Name: Cube (3)
   m_TagString: Plane
   m_Icon: {fileID: 0}
@@ -1052,103 +1052,6 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 956ff4379e83d3c49a9c10310dbf7cc7, type: 3}
---- !u!1001 &2878886757095566546
-PrefabInstance:
-  m_ObjectHideFlags: 0
-  serializedVersion: 2
-  m_Modification:
-    m_TransformParent: {fileID: 0}
-    m_Modifications:
-    - target: {fileID: 2878886757060032033, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_Name
-      value: soul
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_RootOrder
-      value: 8
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalPosition.x
-      value: 128.77
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalPosition.y
-      value: 0.21
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalPosition.z
-      value: -0.03
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 0.7071068
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalRotation.x
-      value: -0.7071068
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalRotation.y
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalRotation.z
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.x
-      value: -90
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.y
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032036, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.z
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.enabled
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.gradient.maxGradient.ctime1
-      value: 31033
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.gradient.maxGradient.ctime2
-      value: 65535
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.gradient.maxGradient.key1.b
-      value: 0.9860713
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.gradient.maxGradient.key1.g
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.gradient.maxGradient.key1.r
-      value: 0.8254717
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.gradient.maxGradient.key2.b
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.gradient.maxGradient.key2.g
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.gradient.maxGradient.key2.r
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 2878886757060032039, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
-      propertyPath: ColorModule.gradient.maxGradient.m_NumColorKeys
-      value: 3
-      objectReference: {fileID: 0}
-    m_RemovedComponents: []
-  m_SourcePrefab: {fileID: 100100000, guid: 92f62c6a97f17ea4cb304325714c822e, type: 3}
 --- !u!1001 &3571941039474348810
 PrefabInstance:
   m_ObjectHideFlags: 0

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

@@ -33,6 +33,11 @@ public class Enemy : MoveCharacter
     public float attackRatio;
     public float maxMoveSpeed, minMoveSpeed;
 
+    public int dropSoul = 1;
+    public GameObject soulPrefab;
+    public float soulStartSpeed = 5f;
+    public float dropSoulAngle = 60f;
+
     private void Awake()
     {
         
@@ -348,12 +353,27 @@ public class Enemy : MoveCharacter
                 aniCollider.Play("Die", 0, 0);
                 isDie = true;
                 dieKeepTime = totalDieKeepTime;
+                DropSouls();
                 break;
             default:
                 break;
         }
     }
 
+    public void DropSouls()
+    {
+        for (int i = 0; i < dropSoul; i++)
+        {
+            float angleInterval = dropSoulAngle / (float)(dropSoul - 1);
+            float angle = 90 + ((float)i - (float)(dropSoul - 1) / 2) * angleInterval;
+            angle = angle / 180 * Mathf.PI;
+            GameObject soulObj = PoolManager.Instantiate(soulPrefab, transform.position);
+            Vector3 dir = new Vector3(Mathf.Cos(angle), Mathf.Sin(angle), 0);
+            print("dir:" + dir);
+            soulObj.GetComponent<Soul>().Burst(dir * soulStartSpeed);
+        }
+    }
+
     public void Jump()
     {
         SetUpSpeed(jumpSpeed);

+ 13 - 0
ActionTowerDefense/Assets/Scripts/Soul.cs

@@ -0,0 +1,13 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Soul : MonoBehaviour
+{
+    public Rigidbody rb;
+
+    public void Burst(Vector3 velocity)
+    {
+        rb.velocity = velocity;
+    }
+}

+ 11 - 0
ActionTowerDefense/Assets/Scripts/Soul.cs.meta

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

+ 2 - 2
ActionTowerDefense/ProjectSettings/TagManager.asset

@@ -13,7 +13,7 @@ TagManager:
   - Default
   - TransparentFX
   - Ignore Raycast
-  - 
+  - Ground
   - Water
   - UI
   - Player
@@ -21,7 +21,7 @@ TagManager:
   - Enemy
   - Tower
   - EnemyTower
-  - 
+  - Soul
   - 
   - 
   - 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно