From ded822e98e8eda49618d17e53407b0df1896e539 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 22 Apr 2022 19:24:15 +0800 Subject: * rename AlienSurvival project to SurvivalTest --- SurvivalTest/Assets/Scripts/Physics/AABBShape.cs | 45 ++++++++++++++++++++++ .../Assets/Scripts/Physics/AABBShape.cs.meta | 11 ++++++ SurvivalTest/Assets/Scripts/Physics/BoxShape.cs | 10 +++++ .../Assets/Scripts/Physics/BoxShape.cs.meta | 11 ++++++ SurvivalTest/Assets/Scripts/Physics/CircleShape.cs | 18 +++++++++ .../Assets/Scripts/Physics/CircleShape.cs.meta | 11 ++++++ .../Assets/Scripts/Physics/PhysicsHelper.cs | 18 +++++++++ .../Assets/Scripts/Physics/PhysicsHelper.cs.meta | 11 ++++++ .../Assets/Scripts/Physics/PolygonShape.cs | 18 +++++++++ .../Assets/Scripts/Physics/PolygonShape.cs.meta | 11 ++++++ SurvivalTest/Assets/Scripts/Physics/README.txt | 1 + .../Assets/Scripts/Physics/README.txt.meta | 7 ++++ SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs | 9 +++++ .../Assets/Scripts/Physics/ShapeBase.cs.meta | 11 ++++++ 14 files changed, 192 insertions(+) create mode 100644 SurvivalTest/Assets/Scripts/Physics/AABBShape.cs create mode 100644 SurvivalTest/Assets/Scripts/Physics/AABBShape.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Physics/BoxShape.cs create mode 100644 SurvivalTest/Assets/Scripts/Physics/BoxShape.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Physics/CircleShape.cs create mode 100644 SurvivalTest/Assets/Scripts/Physics/CircleShape.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs create mode 100644 SurvivalTest/Assets/Scripts/Physics/PhysicsHelper.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs create mode 100644 SurvivalTest/Assets/Scripts/Physics/PolygonShape.cs.meta create mode 100644 SurvivalTest/Assets/Scripts/Physics/README.txt create mode 100644 SurvivalTest/Assets/Scripts/Physics/README.txt.meta create mode 100644 SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs create mode 100644 SurvivalTest/Assets/Scripts/Physics/ShapeBase.cs.meta (limited to 'SurvivalTest/Assets/Scripts/Physics') 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(); + } + + 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: -- cgit v1.1-26-g67d0