From 6dbca86d957f774059068b8dbe01170d71cb0e8f Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 29 Jun 2023 10:04:49 +0800 Subject: *misc --- .../Assets/Scripts/Application/ApplicationMain.cs | 2 - .../Assets/Scripts/Physics/PhysicsManager.cs | 1 + .../Assets/Scripts/Physics/TestQuadtree.cs | 32 ------------ .../Assets/Scripts/Physics/TestQuadtree.cs.meta | 11 ----- .../Assets/Scripts/Physics/TestSpirits.cs | 57 ---------------------- .../Assets/Scripts/Physics/TestSpirits.cs.meta | 11 ----- .../Scripts/Physics/unity-quadtree-master.meta | 8 --- .../Assets/Scripts/Tests/TestQuadtree.cs | 32 ++++++++++++ .../Assets/Scripts/Tests/TestQuadtree.cs.meta | 11 +++++ .../Assets/Scripts/Tests/TestSpirits.cs | 57 ++++++++++++++++++++++ .../Assets/Scripts/Tests/TestSpirits.cs.meta | 11 +++++ WorldlineKeepers/Assets/Scripts/Tools/Info.cs | 1 + .../Tools/Notification/NotificationExtensions.cs | 4 +- .../Scripts/Unit/Characters/PlayerController.cs | 8 +++ 14 files changed, 124 insertions(+), 122 deletions(-) delete mode 100644 WorldlineKeepers/Assets/Scripts/Physics/TestQuadtree.cs delete mode 100644 WorldlineKeepers/Assets/Scripts/Physics/TestQuadtree.cs.meta delete mode 100644 WorldlineKeepers/Assets/Scripts/Physics/TestSpirits.cs delete mode 100644 WorldlineKeepers/Assets/Scripts/Physics/TestSpirits.cs.meta delete mode 100644 WorldlineKeepers/Assets/Scripts/Physics/unity-quadtree-master.meta create mode 100644 WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs create mode 100644 WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs.meta create mode 100644 WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs create mode 100644 WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs.meta (limited to 'WorldlineKeepers/Assets/Scripts') diff --git a/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs b/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs index 3d0477f..18211f0 100644 --- a/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs +++ b/WorldlineKeepers/Assets/Scripts/Application/ApplicationMain.cs @@ -34,9 +34,7 @@ namespace WK { onStartHandler?.Invoke(); - GamePhaseManager.Instance.OnStart(); - } public void OnUpdate() diff --git a/WorldlineKeepers/Assets/Scripts/Physics/PhysicsManager.cs b/WorldlineKeepers/Assets/Scripts/Physics/PhysicsManager.cs index b8f1ec2..61c7f7d 100644 --- a/WorldlineKeepers/Assets/Scripts/Physics/PhysicsManager.cs +++ b/WorldlineKeepers/Assets/Scripts/Physics/PhysicsManager.cs @@ -13,6 +13,7 @@ public enum ColliderType public partial class PhysicsManager : Singleton { + // 共享的四叉树查询存储结果列表 public List sharedRetriveResults => m_SharedRetriveResults; private List m_SharedRetriveResults = new List(); diff --git a/WorldlineKeepers/Assets/Scripts/Physics/TestQuadtree.cs b/WorldlineKeepers/Assets/Scripts/Physics/TestQuadtree.cs deleted file mode 100644 index 2ea967e..0000000 --- a/WorldlineKeepers/Assets/Scripts/Physics/TestQuadtree.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using mh; -using MH; -using Unity.VisualScripting; - -namespace mh -{ - [DefaultExecutionOrder(-1000)] - public class TestQuadtree : MonoBehaviour - { - - private void Awake() - { - } - - private void FixedUpdate() - { - var pos = UnitManager.hero.transform.position; - PhysicsManager.Instance.collisionQuadtreeRange = new Vector4(pos.x, pos.y, 30, 20); - PhysicsManager.Instance.hurtboxQuadtreeRange = new Vector4(pos.x, pos.y, 30, 20); - PhysicsManager.Instance.Update(); - } - - private void OnDrawGizmos() - { - PhysicsManager.Instance.Debug(); - } - } - -} diff --git a/WorldlineKeepers/Assets/Scripts/Physics/TestQuadtree.cs.meta b/WorldlineKeepers/Assets/Scripts/Physics/TestQuadtree.cs.meta deleted file mode 100644 index ed81efe..0000000 --- a/WorldlineKeepers/Assets/Scripts/Physics/TestQuadtree.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f88bde6dc59a579488b9b0aa6906f913 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Physics/TestSpirits.cs b/WorldlineKeepers/Assets/Scripts/Physics/TestSpirits.cs deleted file mode 100644 index 8e46d3d..0000000 --- a/WorldlineKeepers/Assets/Scripts/Physics/TestSpirits.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UIElements; - -public class TestSpirits : MonoBehaviour -{ - public SpiritScript prefab; - - public static List spirits = new List(); - - private const int kMaxCount = 500; - - void Start() - { - int count = kMaxCount - spirits.Count; - for (int i = 0; i < count; ++i) - { - float x = UnityEngine.Random.Range(-20, 10); - float y = UnityEngine.Random.Range(-20, 10); - SpiritScript go = Instantiate(prefab) as SpiritScript; - go.transform.position = new Vector3(x, y, 0); - go.transform.parent = this.transform; - go.gameObject.SetActive(true); - } - StartCoroutine(CoSpawn(5)); - } - - IEnumerator CoSpawn(float interval) - { - while (true) - { - int count = kMaxCount - spirits.Count; - for (int i = 0; i < count; ++i) - { - float x = UnityEngine.Random.Range(-20, 10); - float y = UnityEngine.Random.Range(-20, 10); - SpiritScript go = Instantiate(prefab) as SpiritScript; - go.transform.position = new Vector3(x, y, 0); - go.transform.parent = this.transform; - go.gameObject.SetActive(true); - } - - yield return new WaitForSeconds(interval); - } - } - - private void FixedUpdate() - { - for(int i = 0; i < spirits.Count; ++i) - { - spirits[i].Tick(); - } - } - -} diff --git a/WorldlineKeepers/Assets/Scripts/Physics/TestSpirits.cs.meta b/WorldlineKeepers/Assets/Scripts/Physics/TestSpirits.cs.meta deleted file mode 100644 index 479bb7a..0000000 --- a/WorldlineKeepers/Assets/Scripts/Physics/TestSpirits.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 339ab6a313449b84fb9f51c3b6a1980b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Physics/unity-quadtree-master.meta b/WorldlineKeepers/Assets/Scripts/Physics/unity-quadtree-master.meta deleted file mode 100644 index cbdce18..0000000 --- a/WorldlineKeepers/Assets/Scripts/Physics/unity-quadtree-master.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2fb02811893802a4bb3f07b115453535 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs b/WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs new file mode 100644 index 0000000..2ea967e --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs @@ -0,0 +1,32 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using mh; +using MH; +using Unity.VisualScripting; + +namespace mh +{ + [DefaultExecutionOrder(-1000)] + public class TestQuadtree : MonoBehaviour + { + + private void Awake() + { + } + + private void FixedUpdate() + { + var pos = UnitManager.hero.transform.position; + PhysicsManager.Instance.collisionQuadtreeRange = new Vector4(pos.x, pos.y, 30, 20); + PhysicsManager.Instance.hurtboxQuadtreeRange = new Vector4(pos.x, pos.y, 30, 20); + PhysicsManager.Instance.Update(); + } + + private void OnDrawGizmos() + { + PhysicsManager.Instance.Debug(); + } + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs.meta b/WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs.meta new file mode 100644 index 0000000..ed81efe --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f88bde6dc59a579488b9b0aa6906f913 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs b/WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs new file mode 100644 index 0000000..8e46d3d --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UIElements; + +public class TestSpirits : MonoBehaviour +{ + public SpiritScript prefab; + + public static List spirits = new List(); + + private const int kMaxCount = 500; + + void Start() + { + int count = kMaxCount - spirits.Count; + for (int i = 0; i < count; ++i) + { + float x = UnityEngine.Random.Range(-20, 10); + float y = UnityEngine.Random.Range(-20, 10); + SpiritScript go = Instantiate(prefab) as SpiritScript; + go.transform.position = new Vector3(x, y, 0); + go.transform.parent = this.transform; + go.gameObject.SetActive(true); + } + StartCoroutine(CoSpawn(5)); + } + + IEnumerator CoSpawn(float interval) + { + while (true) + { + int count = kMaxCount - spirits.Count; + for (int i = 0; i < count; ++i) + { + float x = UnityEngine.Random.Range(-20, 10); + float y = UnityEngine.Random.Range(-20, 10); + SpiritScript go = Instantiate(prefab) as SpiritScript; + go.transform.position = new Vector3(x, y, 0); + go.transform.parent = this.transform; + go.gameObject.SetActive(true); + } + + yield return new WaitForSeconds(interval); + } + } + + private void FixedUpdate() + { + for(int i = 0; i < spirits.Count; ++i) + { + spirits[i].Tick(); + } + } + +} diff --git a/WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs.meta b/WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs.meta new file mode 100644 index 0000000..479bb7a --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 339ab6a313449b84fb9f51c3b6a1980b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Info.cs b/WorldlineKeepers/Assets/Scripts/Tools/Info.cs index 50e2d42..54ca2b9 100644 --- a/WorldlineKeepers/Assets/Scripts/Tools/Info.cs +++ b/WorldlineKeepers/Assets/Scripts/Tools/Info.cs @@ -1,3 +1,4 @@ +// 替换tuple public class Info { diff --git a/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs index 8313f7b..3055484 100644 --- a/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs +++ b/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs @@ -3,6 +3,9 @@ using System; namespace WK { + /// + /// 作为消息发布者实现这个接口 + /// public interface INotification { } @@ -12,6 +15,5 @@ namespace WK public static void AddObserver(this INotification _this, string msg, NotificationCenter.NotificatonHandler handler) { NotificationCenter.Instance.AddObserver(_this, msg, handler); } public static void RemoveObserver(this INotification _this, string msg, NotificationCenter.NotificatonHandler handler) { NotificationCenter.Instance.RemoveObserver(_this, msg, handler); } public static void PostNotification(this INotification _this, string msg, params object[] p) { NotificationCenter.Instance.PostNotification(_this, msg, p); } - } } diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/PlayerController.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/PlayerController.cs index 5ca87e6..de13acb 100644 --- a/WorldlineKeepers/Assets/Scripts/Unit/Characters/PlayerController.cs +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/PlayerController.cs @@ -4,6 +4,14 @@ using UnityEngine; namespace WK { + // 玩家角色数据结构 + // PlayerController + // CharacterInfo + // CharacterStats + // CharacterBuffs + // CharacterPerks + // CharacterBehaviour + // CharacterAnimation /// /// 玩家角色根节点 -- cgit v1.1-26-g67d0