summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'SurvivalTest/Assets/Scripts/Physics')
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/AABBShape.cs45
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/AABBShape.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/BoxShape.cs10
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/BoxShape.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/CircleShape.cs18
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/CircleShape.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs18
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs18
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs.meta11
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/README.txt1
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/README.txt.meta7
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs9
-rw-r--r--SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs.meta11
14 files changed, 192 insertions, 0 deletions
diff --git a/SurvivalTest/Assets/Scripts/Physics/AABBShape.cs b/SurvivalTest/Assets/Scripts/Physics/AABBShape.cs
new file mode 100644
index 0000000..abff597
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/AABBShape.cs
@@ -0,0 +1,45 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+[RequireComponent(typeof(TopDownTransform))]
+public class AABBShape : ShapeBase
+{
+
+ [Tooltip("中心点(相对此节点的偏移)")]
+ [SerializeField] private Vector2 m_Centre;
+ public Vector2 centre { get { return m_Centre;} set { m_Centre = value; } }
+
+ [Tooltip("大小(TopDown空间下)")]
+ [SerializeField] private Vector2 m_Size;
+ public Vector2 size { get { return m_Size; } set { m_Size = value; } }
+
+ private TopDownTransform m_TopDownTransform;
+ private TopDownTransform topdownTransform
+ {
+ get
+ {
+ if(m_TopDownTransform == null)
+ {
+ m_TopDownTransform = GetComponent<TopDownTransform>();
+ }
+
+ return m_TopDownTransform;
+ }
+ }
+
+#if UNITY_EDITOR
+
+ private void OnDrawGizmos()
+ {
+ Vector3 pos = topdownTransform.GetProjectedPosition();
+ Handles.color = Color.green;
+ Handles.DrawWireCube(pos + new Vector3(m_Centre.x, m_Centre.y, 0), new Vector3(size.x, size.y, 0));
+ }
+
+#endif
+
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Physics/AABBShape.cs.meta b/SurvivalTest/Assets/Scripts/Physics/AABBShape.cs.meta
new file mode 100644
index 0000000..e7c4f4f
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/AABBShape.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b0b865519e5d4f647a0dd9ea2df1236e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Physics/BoxShape.cs b/SurvivalTest/Assets/Scripts/Physics/BoxShape.cs
new file mode 100644
index 0000000..b5a4e7b
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/BoxShape.cs
@@ -0,0 +1,10 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+[RequireComponent(typeof(TopDownTransform))]
+public class BoxShape : ShapeBase
+{
+
+
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Physics/BoxShape.cs.meta b/SurvivalTest/Assets/Scripts/Physics/BoxShape.cs.meta
new file mode 100644
index 0000000..03de3e1
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/BoxShape.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bdcf6431eefbc384b8c38c8323bb1c89
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Physics/CircleShape.cs b/SurvivalTest/Assets/Scripts/Physics/CircleShape.cs
new file mode 100644
index 0000000..3626598
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/CircleShape.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+[RequireComponent(typeof(TopDownTransform))]
+public class CircleShape : ShapeBase
+{
+ [Tooltip("圆心(相对此节点的偏移)")]
+ [SerializeField] private Vector2 m_Centre;
+ public Vector2 centre { get { return m_Centre; } set { m_Centre = value; } }
+
+ [Tooltip("半径(TopDown空间下)")]
+ [SerializeField] private float m_Radius;
+ public float radius { get { return m_Radius; } set { m_Radius = value; } }
+
+
+
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Physics/CircleShape.cs.meta b/SurvivalTest/Assets/Scripts/Physics/CircleShape.cs.meta
new file mode 100644
index 0000000..814087d
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/CircleShape.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2a0bd7154c667b741961ea5ed11902e5
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs b/SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs
new file mode 100644
index 0000000..907ca05
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class PhysicsHelper : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs.meta b/SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs.meta
new file mode 100644
index 0000000..8fa3233
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7f9f362c9de0e554a86367b068464b72
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs b/SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs
new file mode 100644
index 0000000..ce17bfe
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class PolygonShape : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs.meta b/SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs.meta
new file mode 100644
index 0000000..6116bdb
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0cb3172194a30a741861e9cbb48bfb67
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Physics/README.txt b/SurvivalTest/Assets/Scripts/Physics/README.txt
new file mode 100644
index 0000000..759fc01
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/README.txt
@@ -0,0 +1 @@
+topdown physics module \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Physics/README.txt.meta b/SurvivalTest/Assets/Scripts/Physics/README.txt.meta
new file mode 100644
index 0000000..c7df70e
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/README.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 3b644e307740eba429bf19c41ea90b36
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs b/SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs
new file mode 100644
index 0000000..a0eba25
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs
@@ -0,0 +1,9 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ShapeBase : MonoBehaviour
+{
+
+
+} \ No newline at end of file
diff --git a/SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs.meta b/SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs.meta
new file mode 100644
index 0000000..3942766
--- /dev/null
+++ b/SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 765f0727121051042866a2c615ab2560
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: