summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/Scripts/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'WorldlineKeepers/Assets/Scripts/Tests')
-rw-r--r--WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs32
-rw-r--r--WorldlineKeepers/Assets/Scripts/Tests/TestQuadtree.cs.meta11
-rw-r--r--WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs57
-rw-r--r--WorldlineKeepers/Assets/Scripts/Tests/TestSpirits.cs.meta11
4 files changed, 111 insertions, 0 deletions
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<SpiritScript> spirits = new List<SpiritScript>();
+
+ 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: