Browse Source

给木标签技能的花增加了生成时随机角度和范围,避免重叠

HY-LSZNWIN10\Administrator 1 tháng trước cách đây
mục cha
commit
ae13882867

+ 6 - 4
ActionTowerDefense/Assets/Resources/Prefab/SoulFlower.prefab

@@ -20260,10 +20260,10 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 2084839382815595436}
   m_GameObject: {fileID: 2084839382815595436}
-  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 79.41, y: -15.31, z: 0}
   m_LocalPosition: {x: 79.41, y: -15.31, z: 0}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_LocalScale: {x: 1, y: 1, z: 1}
-  m_ConstrainProportionsScale: 0
+  m_ConstrainProportionsScale: 1
   m_Children:
   m_Children:
   - {fileID: 2084839382897488367}
   - {fileID: 2084839382897488367}
   - {fileID: 2084839381151280520}
   - {fileID: 2084839381151280520}
@@ -20312,6 +20312,8 @@ MonoBehaviour:
   dropSoulAngle: 60
   dropSoulAngle: 60
   exitTime: 20
   exitTime: 20
   dropInterval: 10
   dropInterval: 10
+  angleRange: {x: -30, y: 30}
+  scaleRange: {x: 0.805659, y: 1.2}
 --- !u!54 &2084839382815595432
 --- !u!54 &2084839382815595432
 Rigidbody:
 Rigidbody:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
@@ -20322,7 +20324,7 @@ Rigidbody:
   serializedVersion: 2
   serializedVersion: 2
   m_Mass: 1
   m_Mass: 1
   m_Drag: 0
   m_Drag: 0
-  m_AngularDrag: 0.05
+  m_AngularDrag: 0
   m_UseGravity: 1
   m_UseGravity: 1
   m_IsKinematic: 0
   m_IsKinematic: 0
   m_Interpolate: 0
   m_Interpolate: 0
@@ -20340,7 +20342,7 @@ SphereCollider:
   m_Enabled: 1
   m_Enabled: 1
   serializedVersion: 2
   serializedVersion: 2
   m_Radius: 0.5
   m_Radius: 0.5
-  m_Center: {x: 0, y: 0, z: 0}
+  m_Center: {x: 0, y: 0.32, z: 0}
 --- !u!1 &2084839382897488366
 --- !u!1 &2084839382897488366
 GameObject:
 GameObject:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0

+ 1 - 1
ActionTowerDefense/Assets/Scripts/Characters/Enemy.cs

@@ -682,7 +682,7 @@ public class Enemy : MoveCharacter
                     int randomInt = Random.Range(0, 100);
                     int randomInt = Random.Range(0, 100);
                     if (randomInt < GameManager.instance.woodProbability)
                     if (randomInt < GameManager.instance.woodProbability)
                     {
                     {
-                        PoolManager.Instantiate(Resources.Load<GameObject>("Prefab/SoulFlower"), transform.position);
+                        PoolManager.Instantiate(Resources.Load<GameObject>("Prefab/SoulFlower"), transform.position).GetComponent<SoulFlower>().Init(false);
                     }
                     }
                 }
                 }
                 break;
                 break;

+ 0 - 1
ActionTowerDefense/Assets/Scripts/Characters/MoveCharacter.cs

@@ -566,7 +566,6 @@ public class MoveCharacter : Character
     {
     {
         if (!isElectrify)
         if (!isElectrify)
         {
         {
-            Debug.Log("¹ÒÉϸеç");
             isElectrify = true;
             isElectrify = true;
             ani.speed = GameManager.instance.attackSpeedScale;
             ani.speed = GameManager.instance.attackSpeedScale;
             moveSpeedScale = GameManager.instance.moveSpeedScale;
             moveSpeedScale = GameManager.instance.moveSpeedScale;

+ 15 - 1
ActionTowerDefense/Assets/Scripts/SoulFlower.cs

@@ -1,6 +1,7 @@
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine;
+using Sirenix.OdinInspector;
 
 
 public class SoulFlower : MonoBehaviour
 public class SoulFlower : MonoBehaviour
 {
 {
@@ -18,6 +19,12 @@ public class SoulFlower : MonoBehaviour
 
 
     private bool isDistoryOnDisable = false;
     private bool isDistoryOnDisable = false;
 
 
+    [MinMaxSlider(-180, 180, ShowFields = true)]
+    public Vector2 angleRange = new Vector2(0, 360);
+
+    [MinMaxSlider(0.5f, 2f, ShowFields = true)]
+    public Vector2 scaleRange = new Vector2(0.5f, 2f);
+
     private void OnEnable()
     private void OnEnable()
     {
     {
         exitTimer = Time.time;
         exitTimer = Time.time;
@@ -32,7 +39,14 @@ public class SoulFlower : MonoBehaviour
     public void Init(bool _isDistoryOnDisable)
     public void Init(bool _isDistoryOnDisable)
     {
     {
         isDistoryOnDisable = _isDistoryOnDisable;
         isDistoryOnDisable = _isDistoryOnDisable;
-        Destroy(GetComponent<Rigidbody>());
+        if(isDistoryOnDisable) Destroy(GetComponent<Rigidbody>());
+        else
+        {
+            transform.rotation = Quaternion.Euler(0f, 0f, Random.Range(angleRange.x, angleRange.y));
+            float scale = Random.Range(scaleRange.x, scaleRange.y);
+            transform.localScale = new Vector3(scale, scale, scale);
+        }
+
     }
     }
 
 
     private void Update()
     private void Update()