diff options
Diffstat (limited to 'AlienSurvival/Assets/Scripts')
138 files changed, 0 insertions, 3694 deletions
diff --git a/AlienSurvival/Assets/Scripts/Editor.meta b/AlienSurvival/Assets/Scripts/Editor.meta deleted file mode 100644 index 58829a3..0000000 --- a/AlienSurvival/Assets/Scripts/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d4ca91bb615252040a8e7572963b172a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Editor/TransformInspectorOverride.cs b/AlienSurvival/Assets/Scripts/Editor/TransformInspectorOverride.cs deleted file mode 100644 index 76cb48c..0000000 --- a/AlienSurvival/Assets/Scripts/Editor/TransformInspectorOverride.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -[CanEditMultipleObjects, CustomEditor(typeof(Transform), true)] -public class TransformInspectorOverride : InspectorExt -{ - protected override string defaultEditorName => "UnityEditor.TransformInspector, UnityEditor"; - - Tool LastTool = Tool.None; - - public override void OnEnable() - { - base.OnEnable(); - - if(HasTopDownTransform()) - HideDefaultTools(); - } - - public override void OnDisable() - { - base.OnDisable(); - - if(LastTool != Tool.None) - RestoreTools(); - } - - void HideDefaultTools() - { - if(Tools.current != Tool.None) - LastTool = Tools.current; - Tools.current = Tool.None; - } - - void RestoreTools() - { - Tools.current = LastTool; - } - - public override void OnInspectorGUI() - { - if (HasTopDownTransform()) - { - EditorGUILayout.HelpBox("Override by TopDownTransform", MessageType.Warning); - GUI.enabled = false; - HideDefaultTools(); - } - - base.OnInspectorGUI(); - - if (HasTopDownTransform()) - GUI.enabled = true; - } - - bool HasTopDownTransform() - { - Transform transform = target as Transform; - TopDownTransform topdown = transform.GetComponent<TopDownTransform>(); - return topdown != null; - } - - public override void OnSceneGUI() - { - base.OnSceneGUI(); - } - -} diff --git a/AlienSurvival/Assets/Scripts/Editor/TransformInspectorOverride.cs.meta b/AlienSurvival/Assets/Scripts/Editor/TransformInspectorOverride.cs.meta deleted file mode 100644 index c9f0922..0000000 --- a/AlienSurvival/Assets/Scripts/Editor/TransformInspectorOverride.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8027cfacc5652a6459adfbe2d9522671 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/GameApp.cs b/AlienSurvival/Assets/Scripts/GameApp.cs deleted file mode 100644 index d5f9d70..0000000 --- a/AlienSurvival/Assets/Scripts/GameApp.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[DisallowMultipleComponent] -public class GameApp : MonoBehaviour -{ - - void Start() - { - - } - - void Update() - { - GameLoop.Instance.Update(); - TinyCountDown.Instance.Update(); - } - - void LateUpdate() - { - - } - -} diff --git a/AlienSurvival/Assets/Scripts/GameApp.cs.meta b/AlienSurvival/Assets/Scripts/GameApp.cs.meta deleted file mode 100644 index 3c64a3e..0000000 --- a/AlienSurvival/Assets/Scripts/GameApp.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4a8eff5fd2fd4e34e8896ce4c086ba44 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: -1100 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Physics.meta b/AlienSurvival/Assets/Scripts/Physics.meta deleted file mode 100644 index cfe079d..0000000 --- a/AlienSurvival/Assets/Scripts/Physics.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7e5fc1a856751be4286cf39720d597cb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Physics/AABBShape.cs b/AlienSurvival/Assets/Scripts/Physics/AABBShape.cs deleted file mode 100644 index abff597..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/AABBShape.cs +++ /dev/null @@ -1,45 +0,0 @@ -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/AlienSurvival/Assets/Scripts/Physics/AABBShape.cs.meta b/AlienSurvival/Assets/Scripts/Physics/AABBShape.cs.meta deleted file mode 100644 index e7c4f4f..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/AABBShape.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b0b865519e5d4f647a0dd9ea2df1236e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Physics/BoxShape.cs b/AlienSurvival/Assets/Scripts/Physics/BoxShape.cs deleted file mode 100644 index b5a4e7b..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/BoxShape.cs +++ /dev/null @@ -1,10 +0,0 @@ -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/AlienSurvival/Assets/Scripts/Physics/BoxShape.cs.meta b/AlienSurvival/Assets/Scripts/Physics/BoxShape.cs.meta deleted file mode 100644 index 03de3e1..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/BoxShape.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bdcf6431eefbc384b8c38c8323bb1c89 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Physics/CircleShape.cs b/AlienSurvival/Assets/Scripts/Physics/CircleShape.cs deleted file mode 100644 index 3626598..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/CircleShape.cs +++ /dev/null @@ -1,18 +0,0 @@ -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/AlienSurvival/Assets/Scripts/Physics/CircleShape.cs.meta b/AlienSurvival/Assets/Scripts/Physics/CircleShape.cs.meta deleted file mode 100644 index 814087d..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/CircleShape.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2a0bd7154c667b741961ea5ed11902e5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Physics/PhysicsHelper.cs b/AlienSurvival/Assets/Scripts/Physics/PhysicsHelper.cs deleted file mode 100644 index 907ca05..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/PhysicsHelper.cs +++ /dev/null @@ -1,18 +0,0 @@ -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/AlienSurvival/Assets/Scripts/Physics/PhysicsHelper.cs.meta b/AlienSurvival/Assets/Scripts/Physics/PhysicsHelper.cs.meta deleted file mode 100644 index 8fa3233..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/PhysicsHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7f9f362c9de0e554a86367b068464b72 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Physics/PolygonShape.cs b/AlienSurvival/Assets/Scripts/Physics/PolygonShape.cs deleted file mode 100644 index ce17bfe..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/PolygonShape.cs +++ /dev/null @@ -1,18 +0,0 @@ -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/AlienSurvival/Assets/Scripts/Physics/PolygonShape.cs.meta b/AlienSurvival/Assets/Scripts/Physics/PolygonShape.cs.meta deleted file mode 100644 index 6116bdb..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/PolygonShape.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0cb3172194a30a741861e9cbb48bfb67 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Physics/README.txt b/AlienSurvival/Assets/Scripts/Physics/README.txt deleted file mode 100644 index 759fc01..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/README.txt +++ /dev/null @@ -1 +0,0 @@ -topdown physics module
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/Physics/README.txt.meta b/AlienSurvival/Assets/Scripts/Physics/README.txt.meta deleted file mode 100644 index c7df70e..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/README.txt.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 3b644e307740eba429bf19c41ea90b36 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Physics/ShapeBase.cs b/AlienSurvival/Assets/Scripts/Physics/ShapeBase.cs deleted file mode 100644 index a0eba25..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/ShapeBase.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class ShapeBase : MonoBehaviour -{ - - -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/Physics/ShapeBase.cs.meta b/AlienSurvival/Assets/Scripts/Physics/ShapeBase.cs.meta deleted file mode 100644 index 3942766..0000000 --- a/AlienSurvival/Assets/Scripts/Physics/ShapeBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 765f0727121051042866a2c615ab2560 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Rendering.meta b/AlienSurvival/Assets/Scripts/Rendering.meta deleted file mode 100644 index 5983da2..0000000 --- a/AlienSurvival/Assets/Scripts/Rendering.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f708dc500b39f5b47b15cab2502b39ee -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test.meta b/AlienSurvival/Assets/Scripts/Test.meta deleted file mode 100644 index 77f1e2b..0000000 --- a/AlienSurvival/Assets/Scripts/Test.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 52be12b547ad9fd4bb3108d3411818c0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestAstro.cs b/AlienSurvival/Assets/Scripts/Test/TestAstro.cs deleted file mode 100644 index 3b4df18..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestAstro.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestAstro : MonoBehaviour -{ - [SerializeField] private Transform m_Camera; - - [SerializeField] private float m_Speed; - - [SerializeField] private SpriteRenderer m_Shadow; - - private SpriteRenderer m_SpriteRenderer; - private TestFakeHeight m_FakeHeight; - - - - void Start() - { - m_SpriteRenderer = GetComponent<SpriteRenderer>(); - m_FakeHeight = GetComponent<TestFakeHeight>(); - } - - void Update() - { - float x = Input.GetAxisRaw("Horizontal"); - float y = Input.GetAxisRaw("Vertical"); - - Vector3 targetZoom = Vector3.one; - - if(x != 0 || y != 0) - { - targetZoom = new Vector3(1f, 1f, 1); - - Vector2 direction = new Vector2(x, y).normalized; - - Vector3 position = transform.position; - position.x += direction.x * m_Speed * Time.deltaTime; - position.y += direction.y * m_Speed * Time.deltaTime; - - transform.position = position; - - if (x > 0) - { - m_SpriteRenderer.flipX = false; - m_Shadow.flipX = false; - } - else if (x < 0) - { - m_SpriteRenderer.flipX = true; - m_Shadow.flipX = true; - } - } - else - { - targetZoom = new Vector3(0.5f, 0.5f, 1); - } - - Vector3 zoom = m_Camera.localScale; - m_Camera.localScale = Vector3.Lerp(zoom, targetZoom, Time.deltaTime); - - CameraFollow(); - } - - void CameraFollow() - { - Vector3 pos = m_Camera.position; - pos.x = m_FakeHeight.x; - pos.y = m_FakeHeight.y; - - if(Vector3.Distance(pos, m_Camera.position) > 0.1f) - { - m_Camera.position = Vector3.Lerp(m_Camera.position, pos, 3 * Time.deltaTime); - } - - } -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestAstro.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestAstro.cs.meta deleted file mode 100644 index a96a9b4..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestAstro.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dc04e45eaa06e994a806119e4fd0701c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestB2.cs b/AlienSurvival/Assets/Scripts/Test/TestB2.cs deleted file mode 100644 index 532c254..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestB2.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestB2 : MonoBehaviour -{ - [SerializeField] private TestBomb m_Bomb; - [SerializeField] private float m_Speed; - - private Vector3 m_From; - private Vector3 m_To; - - private Coroutine m_CoBomb; - - Vector3 direction - { - get - { - return (m_To - m_From).normalized; - } - } - - /// <summary> - /// from to 在3d空间 - /// </summary> - /// <param name="from"></param> - /// <param name="to"></param> - public void Set(Vector3 from, Vector3 to, float speed, float lifeTime) - { - m_From = from; - m_To = to; - m_Speed = speed; - - transform.position = from; - - this.gameObject.SetActive(true); - - m_CoBomb = StartCoroutine(coBomb(0.1f)); - - Invoke("DestroySelf", lifeTime); - } - - void DestroySelf() - { - if (m_CoBomb != null) - { - StopCoroutine(m_CoBomb); - m_CoBomb = null; - } - this.gameObject.SetActive(false); - Destroy(this.gameObject); - } - - private void Update() - { - Vector3 pos = transform.position; - pos += direction * m_Speed * Time.deltaTime; - - transform.position = pos; - } - - IEnumerator coBomb(float interval) - { - while (true) - { - Vector3 pos = transform.position; - for(int i = 0; i < 1; ++i) - { - TestBomb grenade = Instantiate<TestBomb>(m_Bomb); - Vector3 position = new Vector3(pos.x + Random.Range(-3, 3), pos.y + Random.Range(-5f, 5f), 7f); - grenade.Set(position, new Vector3(0, 0, -1f), Random.Range(8f, 10f)); - grenade.gameObject.SetActive(true); - } - - yield return new WaitForSeconds(interval); - } - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestB2.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestB2.cs.meta deleted file mode 100644 index 1e507c7..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestB2.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a908894d8ef917543ad67959640ec30b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestBeamBullet.cs b/AlienSurvival/Assets/Scripts/Test/TestBeamBullet.cs deleted file mode 100644 index 17d0005..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBeamBullet.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestBeamBullet : MonoBehaviour -{ - public Vector3 direction; - public float speed; - - // Start is called before the first frame update - void Start() - { - Invoke("Dead", 3); - } - - void Dead() - { - if (this.gameObject) - { - GameObject.Destroy(this.gameObject); - } - } - - // Update is called once per frame - void Update() - { - Vector3 position = transform.position; - position += direction * speed * Time.deltaTime; - transform.position = position; - } - - private void OnTriggerEnter2D(Collider2D collision) - { - GameObject go = collision.gameObject; - - if (!go.CompareTag("enemy")) - { - return; - } - - GameObject.Destroy( collision.gameObject); - - //this.gameObject.SetActive(false); - - if (this.gameObject) - { - GameObject.Destroy(this.gameObject); - } - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestBeamBullet.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestBeamBullet.cs.meta deleted file mode 100644 index b1551a7..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBeamBullet.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ca62ef044d3b4104eac135eea37e0c03 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestBeamGun.cs b/AlienSurvival/Assets/Scripts/Test/TestBeamGun.cs deleted file mode 100644 index 69225b6..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBeamGun.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestBeamGun : MonoBehaviour -{ - public TestBeamBullet bullet; - - public Transform start; - - public float speed = 1; - - SpriteRenderer sprite; - - // Start is called before the first frame update - void Start() - { - sprite = GetComponent<SpriteRenderer>(); - - // StartCoroutine(coFire()); - } - - // Update is called once per frame - void Update() - { - - Vector3 screenPos = Input.mousePosition; - - Vector2 target = Camera.main.ScreenToWorldPoint(screenPos); - - Vector2 dir = Vector2.ClampMagnitude(target - (Vector2)transform.position, 1); - Vector3 move = dir * speed * Time.deltaTime; - - float x = move.x; - if (x > 0) - { - sprite.flipY = false; - } - else if (x < 0) - { - sprite.flipY = true; - } - - transform.rotation = Quaternion.Euler(0, 0, Mathf.Rad2Deg * Mathf.Atan2(dir.y, dir.x)); - - Shot(); - } - - void Shot() - { - if (Input.GetButtonDown("Fire1")) - { - //Debug.Log("Shoot"); - - TestBeamBullet b = TestBeamBullet.Instantiate(bullet); - b.gameObject.SetActive(true); - - b.transform.position = start.position; - - b.direction = transform.right; - } - } - - IEnumerator coFire() - { - while (true) - { - TestBeamBullet b = TestBeamBullet.Instantiate(bullet); - b.gameObject.SetActive(true); - - b.transform.position = start.position; - - b.direction = transform.right; - - yield return new WaitForSeconds(0.5f); - } - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestBeamGun.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestBeamGun.cs.meta deleted file mode 100644 index cfeb8f2..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBeamGun.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 058a2b89691b2f94d912ff341719edd9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestBomb.cs b/AlienSurvival/Assets/Scripts/Test/TestBomb.cs deleted file mode 100644 index 77933f4..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBomb.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestBomb : MonoBehaviour -{ - - [SerializeField] private float m_GravityScale = 1f; - - [SerializeField] private GameObject m_ExplosionEffect; - - private TopDownTransform m_Coords; - - private Vector3 GRAVITY = new Vector3(0, 0, -9.8f); - - private Vector3 m_Velocity; // x, y, fakeHeight - - /// <summary> - /// 设置初始参数,都在fake空间下 - /// </summary> - /// <param name="initPosition"></param> - /// <param name="initDirection"></param> - /// <param name="initSpeed"></param> - public void Set(Vector3 initPosition, Vector3 initDirection, float initSpeed) - { - m_Coords = GetComponent<TopDownTransform>(); - m_Coords.position = initPosition; - - m_Velocity = initDirection * initSpeed; - } - - private void Update() - { - Vector3 move = m_Velocity * Time.deltaTime; - - if (m_Velocity.magnitude > 0 && m_Coords.z + move.z >= 0) - { - m_Coords.x += move.x; - m_Coords.y += move.y; - m_Coords.z += move.z; - m_Velocity += GRAVITY * Time.deltaTime; - - //transform.rotation *= Quaternion.Euler(0, 0, 20 * m_Velocity.magnitude * Time.deltaTime); - } - else - { - m_Velocity = Vector3.zero; - - this.gameObject.SetActive(false); - Destroy(this.gameObject); - PlayExplosion(); - } - } - - private void PlayExplosion() - { - GameObject exp = Instantiate<GameObject>(m_ExplosionEffect); - - TopDownTransform coord = exp.GetComponent<TopDownTransform>(); - coord.position = m_Coords.position; - - exp.GetComponent<TopDownSorting>().Sorting(); - - exp.SetActive(true); - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestBomb.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestBomb.cs.meta deleted file mode 100644 index 06d61d2..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBomb.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c0bb267c6728269489ed4f713b032db5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestBrokenPiece.cs b/AlienSurvival/Assets/Scripts/Test/TestBrokenPiece.cs deleted file mode 100644 index 4399886..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBrokenPiece.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestBrokenPiece : MonoBehaviour -{ - [SerializeField] private List<Sprite> m_Pieces; - - private TestFakeHeight m_Coord; - - private Vector3 m_Velocity; - - private Vector3 m_Gravity = new Vector3(0, 0, -9.8f); - - private float m_Damp = 0.5f; - - private SpriteRenderer m_SpriteRenderer; - - enum State - { - Avlie , - Dead , - } - - State m_State; - - private void Awake() - { - m_Coord = GetComponent<TestFakeHeight>(); - m_SpriteRenderer = GetComponent<SpriteRenderer>(); - } - - public void Set(Vector3 position, Vector3 dir, float speed, int index) - { - m_Coord = GetComponent<TestFakeHeight>(); - m_SpriteRenderer = GetComponent<SpriteRenderer>(); - - m_Coord.x = position.x; - m_Coord.y = position.y; - m_Coord.height = position.z; - - m_Velocity = dir * speed; - - m_SpriteRenderer.sprite = m_Pieces[index % m_Pieces.Count]; - - m_State = State.Avlie; - } - - private void Update() - { - if(m_State == State.Avlie) - { - m_Velocity += m_Gravity * Time.deltaTime; - - m_Coord.x += m_Velocity.x * Time.deltaTime; - m_Coord.y += m_Velocity.y * Time.deltaTime; - m_Coord.height += m_Velocity.z * Time.deltaTime; - - if (m_Coord.height < 0) - { - m_Coord.height = 0; - - // bounce - m_Velocity.x = m_Velocity.x * m_Damp; - m_Velocity.y = m_Velocity.y * m_Damp; - m_Velocity.z = -m_Velocity.z * m_Damp; - - if (m_Velocity.magnitude < 0.1f) - { - m_State = State.Dead; - StartCoroutine(coDead(Random.Range(1f, 3f))); - } - } - } - else if(m_State == State.Dead) - { - } - } - - IEnumerator coDead( float time) - { - Color c = m_SpriteRenderer.color; - - float t = 0; - while (true) - { - t += Time.deltaTime; - - c.a = (time - t) / time; - - m_SpriteRenderer.color = c; - - if(t > time) - { - break; - } - - yield return null; - } - - this.gameObject.SetActive(false); - Destroy(this.gameObject); - - yield break; - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestBrokenPiece.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestBrokenPiece.cs.meta deleted file mode 100644 index 73da026..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBrokenPiece.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c7182d8bf5ade5c47a2a98ae355119f3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestBucket.cs b/AlienSurvival/Assets/Scripts/Test/TestBucket.cs deleted file mode 100644 index c3e28f4..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBucket.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestBucket : MonoBehaviour -{ - [SerializeField] private TestBrokenPiece m_Piece; - - private TopDownTransform m_Coord; - - private void Awake() - { - m_Coord = GetComponent<TopDownTransform>(); - } - - public void Broken() - { - for(int i = 0; i < 10; ++i) - { - TestBrokenPiece piece = Instantiate<TestBrokenPiece>(m_Piece); - piece.Set(m_Coord.position + new Vector3(0,0,1f), - new Vector3(Random.Range(-1f,1f), Random.Range(-1f, 1f), Random.Range(0.5f, 2f)).normalized, Random.Range(1f, 3f) - , i); - } - - this.gameObject.SetActive(false); - Destroy(this.gameObject); - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestBucket.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestBucket.cs.meta deleted file mode 100644 index 3d9e92b..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestBucket.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b3861aac24d796348936aa3f51d27a97 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestCameraSortByY.cs b/AlienSurvival/Assets/Scripts/Test/TestCameraSortByY.cs deleted file mode 100644 index 585f2c3..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestCameraSortByY.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[RequireComponent(typeof(Camera))] -public class TestCameraSortByY : MonoBehaviour -{ - private Camera camera; - - // Start is called before the first frame update - void Start() - { - camera = GetComponent<Camera>(); - camera.transparencySortMode = TransparencySortMode.CustomAxis; - camera.transparencySortAxis = Vector3.up; - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestCameraSortByY.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestCameraSortByY.cs.meta deleted file mode 100644 index 210a02e..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestCameraSortByY.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b692e7619b71ada41b02f616b9a6134d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestCannon.cs b/AlienSurvival/Assets/Scripts/Test/TestCannon.cs deleted file mode 100644 index 22b168b..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestCannon.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestCannon : MonoBehaviour -{ - public TestBeamBullet bullet; - - public Transform start; - - public float speed = 1; - - SpriteRenderer sprite; - - // Start is called before the first frame update - void Start() - { - sprite = GetComponent<SpriteRenderer>(); - - StartCoroutine(coFire(1f)); - } - - // Update is called once per frame - void Update() - { - - } - - IEnumerator coFire(float interval) - { - while (true) - { - TestBeamBullet b = TestBeamBullet.Instantiate(bullet); - b.gameObject.SetActive(true); - - b.transform.position = start.position; - - b.direction = -transform.right; - - yield return new WaitForSeconds(interval); - } - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestCannon.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestCannon.cs.meta deleted file mode 100644 index 52c902c..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestCannon.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 14e80cec1a94a5449b2081ac81bea639 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestCharacterMovement.cs b/AlienSurvival/Assets/Scripts/Test/TestCharacterMovement.cs deleted file mode 100644 index 8911ea9..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestCharacterMovement.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestCharacterMovement : MonoBehaviour -{ - public SpriteRenderer sprite; - - public float speed; - - // Start is called before the first frame update - void Start() - { - sprite = GetComponent<SpriteRenderer>(); - - } - - // Update is called once per frame - void Update() - { - float x = Input.GetAxis("Horizontal"); - float y = Input.GetAxis("Vertical"); - - Vector3 position = transform.position; - position.x += x * speed * Time.deltaTime; - position.y += y * speed * Time.deltaTime; - - transform.position = position; - - if (x > 0) - { - sprite.flipX = false; - } - else if(x < 0) - { - sprite.flipX = true; - } - - } -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestCharacterMovement.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestCharacterMovement.cs.meta deleted file mode 100644 index 606b4cc..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestCharacterMovement.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a2fd7e5c6f466b7448001599a97c5b58 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestDestroySelf.cs b/AlienSurvival/Assets/Scripts/Test/TestDestroySelf.cs deleted file mode 100644 index e0457cd..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestDestroySelf.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestDestroySelf : MonoBehaviour -{ - public float lifeTime; - - public AnimationCurve alphaCurve; - - private float time; - - private SpriteRenderer sr; - - void Start() - { - Invoke("DestroySelf", lifeTime); - time = 0; - sr = GetComponent<SpriteRenderer>(); - } - - void DestroySelf() - { - this.gameObject.SetActive(false); - Destroy(this.gameObject); - } - - void Update() - { - time += Time.deltaTime; - - if (sr) - { - Color c = sr.color; - c.a = alphaCurve.Evaluate(time / lifeTime); - sr.color = c; - } - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestDestroySelf.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestDestroySelf.cs.meta deleted file mode 100644 index c1dc2b5..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestDestroySelf.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6bde42b3ff5cbc44ca4e036544c3cde9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestEnforceTransform0.cs b/AlienSurvival/Assets/Scripts/Test/TestEnforceTransform0.cs deleted file mode 100644 index 57b777d..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestEnforceTransform0.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestEnforceTransform0 : MonoBehaviour -{ - void Update() - { -// transform.localToWorldMatrix = Matrix4x4.identity; - } -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestEnforceTransform0.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestEnforceTransform0.cs.meta deleted file mode 100644 index 3371029..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestEnforceTransform0.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 666db70fcce7c7e4a94cc321eb68e307 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestFakeCube.cs b/AlienSurvival/Assets/Scripts/Test/TestFakeCube.cs deleted file mode 100644 index 5d8f2c5..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestFakeCube.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestFakeCube : MonoBehaviour -{ - public float z; // fake height - - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } - - - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestFakeCube.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestFakeCube.cs.meta deleted file mode 100644 index 83c3602..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestFakeCube.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 84033172d3ac67f4eb3eb8586b6ecb11 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestFakeHeight.cs b/AlienSurvival/Assets/Scripts/Test/TestFakeHeight.cs deleted file mode 100644 index 4cc13d1..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestFakeHeight.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -#if UNITY_EDITOR -using UnityEditor; -#endif - -//[ExecuteInEditMode] -public class TestFakeHeight : MonoBehaviour -{ - [SerializeField] private Transform m_Shadow; - [SerializeField] private Vector3 m_Coord; - - - public float height { - get - { - return m_Height; - } - set - { - m_Height = value; - } - } - [SerializeField] private float m_Height; // current fake height - - public float x - { - get - { - return transform.position.x; - } - - set - { - Vector3 pos = transform.position; - pos.x = value; - transform.position = pos; - } - } - - public float y - { - get - { - return transform.position.y - m_Height; - } - set - { - Vector3 pos = transform.position; - pos.y = value + m_Height; - transform.position = pos; - } - } - - public Vector3 position - { - get - { - Vector3 pos = new Vector3(x, y, height); - return pos; - } - set - { - height = value.z; // height先设置 - x = value.x; - y = value.y; - } - } - - public Vector2 positionOnGround - { - get - { - Vector2 pos = new Vector2(x, y); - return pos; - } - set - { - x = value.x; - y = value.y; - } - } - - private SpriteRenderer m_SpriteRenderer; - - private void OnEnable() - { - m_SpriteRenderer = GetComponent<SpriteRenderer>(); - } - - private void Start() - { - Project(); - } - - void Project() - { - Vector3 pos = transform.position; - pos.y = y + height; - transform.position = pos; - - if (m_Shadow != null) - { - m_Shadow.position = new Vector3(transform.position.x, transform.position.y - m_Height, transform.position.z); - } - - // 根据y设置sortOrder - m_SpriteRenderer.sortingOrder = (int)(-y * 100); - } - - void Update() - { - Project(); - } - -#if UNITY_EDITOR - - private void OnDrawGizmos() - { - // dash line - Vector3 start = transform.position; - Vector3 end = start - new Vector3(0, m_Height, 0); - - Handles.DrawDottedLine(start, end, 1f); - Handles.DrawWireCube(end, new Vector3(0.1f, 0.1f, 0f)); - - } - -#endif - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestFakeHeight.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestFakeHeight.cs.meta deleted file mode 100644 index a91173e..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestFakeHeight.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 780072e6ea35d1f4abd930754c5e9c9f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestGrenade.cs b/AlienSurvival/Assets/Scripts/Test/TestGrenade.cs deleted file mode 100644 index a1434d8..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestGrenade.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestPseudoVec3 -{ - public float x; - public float y; - public float h; - public TestPseudoVec3(float x, float y, float h) - { - this.x = x; - this.y = y; - this.h = h; - } -} - -public class TestGrenade : MonoBehaviour -{ - public bool useGravity; - - public float gravity = -9.8f; - - public TestPseudoVec3 velocity; - public TestPseudoVec3 pseudoPos; - - public Transform shadow; - - private bool m_IsGround - { - get - { - return pseudoPos.h <= 0; - } - } - - // Start is called before the first frame update - void Start() - { - //Invoke("Dead", 3); - } - - void Dead() - { - if (this.gameObject) - { - GameObject.Destroy(this.gameObject); - } - } - - // Update is called once per frame - void Update() - { - if(useGravity && !m_IsGround) - { - velocity.h += gravity * Time.deltaTime; - } - - pseudoPos.x += velocity.x * Time.deltaTime; - pseudoPos.y += velocity.y * Time.deltaTime; - pseudoPos.h += velocity.h * Time.deltaTime; - - if(m_IsGround) - { - velocity.h = -velocity.h; - pseudoPos.h = 0; - } - - Vector3 position = transform.position; - - position.x = pseudoPos.x; - position.y = pseudoPos.y + pseudoPos.h; - - transform.position = position; - - if (shadow) - { - // shadow position - shadow.rotation = Quaternion.identity; - Vector3 shadowPos = Vector3.zero; - shadowPos.x = pseudoPos.x; - shadowPos.y = pseudoPos.y; - shadowPos.z = 0; - shadow.position = shadowPos; - } - } - - private void OnTriggerEnter2D(Collider2D collision) - { - //GameObject go = collision.gameObject; - - //if (!go.CompareTag("enemy")) - //{ - // return; - //} - - //GameObject.Destroy(collision.gameObject); - - ////this.gameObject.SetActive(false); - - //if (this.gameObject) - //{ - // GameObject.Destroy(this.gameObject); - //} - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestGrenade.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestGrenade.cs.meta deleted file mode 100644 index f5d87e9..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestGrenade.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 76da92161ea22274996c5bc1d0bdea94 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestLauncher.cs b/AlienSurvival/Assets/Scripts/Test/TestLauncher.cs deleted file mode 100644 index f053854..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestLauncher.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestLauncher : MonoBehaviour -{ - public TestGrenade bullet; - - public Transform shadow; - - public Transform start; - - public float speed = 1; - - SpriteRenderer sprite; - - // Start is called before the first frame update - void Start() - { - sprite = GetComponent<SpriteRenderer>(); - } - - // Update is called once per frame - void Update() - { - - Vector3 screenPos = Input.mousePosition; - - Vector2 target = Camera.main.ScreenToWorldPoint(screenPos); - - Vector2 dir = Vector2.ClampMagnitude(target - (Vector2)transform.position, 1); - Vector3 move = dir * speed * Time.deltaTime; - - float x = move.x; - if (x > 0) - { - sprite.flipY = false; - } - else if (x < 0) - { - sprite.flipY = true; - } - - transform.rotation = Quaternion.Euler(0, 0, Mathf.Rad2Deg * Mathf.Atan2(dir.y, dir.x)); - - Shot(); - } - - void Shot() - { - if (Input.GetButtonDown("Fire1")) - { - //Debug.Log("Shoot"); - - TestGrenade b = TestGrenade.Instantiate(bullet); - b.gameObject.SetActive(true); - - b.transform.position = start.position; - - b.pseudoPos = new TestPseudoVec3(start.position.x, start.position.y, 0.1f); - - float speed = 5; - b.velocity = new TestPseudoVec3(transform.right.x * speed, transform.right.y * speed, 3f); - } - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestLauncher.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestLauncher.cs.meta deleted file mode 100644 index 8688fc3..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestLauncher.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 45111da1fa00b2a4192afc01c5be0873 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestMathHelper.cs b/AlienSurvival/Assets/Scripts/Test/TestMathHelper.cs deleted file mode 100644 index 239d8ed..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestMathHelper.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestMathHelper : MonoBehaviour -{ - - public static Vector2 Rotate(Vector2 v, float delta) - { - return new Vector2( - v.x * Mathf.Cos(delta) - v.y * Mathf.Sin(delta), - v.x * Mathf.Sin(delta) + v.y * Mathf.Cos(delta) - ); - } - - /// <summary> - /// 返回角度 - /// </summary> - /// <param name="vector2"></param> - /// <returns></returns> - public static float Angle(Vector2 vector2) - { - return 360 - (Mathf.Atan2(vector2.y, vector2.x) * Mathf.Rad2Deg * Mathf.Sign(vector2.y)); - } - - public static int Check(bool condition) - { - return condition ? 1 : 0; - } - - //public static float Angle(Vector2 vector2) - //{ - // if (vector2.x < 0) - // { - // return 360 - (Mathf.Atan2(vector2.x, vector2.y) * Mathf.Rad2Deg * -1); - // } - // else - // { - // return Mathf.Atan2(vector2.x, vector2.y) * Mathf.Rad2Deg; - // } - //} - -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/Test/TestMathHelper.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestMathHelper.cs.meta deleted file mode 100644 index 872d038..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestMathHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c40b8edb8d6570e419f024263e4cc43a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestMirror.cs b/AlienSurvival/Assets/Scripts/Test/TestMirror.cs deleted file mode 100644 index 832c785..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestMirror.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestMirror : MonoBehaviour -{ - HashSet<GameObject> m_Mirrored = new HashSet<GameObject>(); - - private void OnTriggerEnter2D(Collider2D collision) - { - GameObject go = collision.gameObject; - if (go && go.CompareTag("bullet") && !m_Mirrored.Contains(go)) - { - //Debug.Log("mirror"); - - go.GetComponent<TestBeamBullet>().direction.x = -go.GetComponent<TestBeamBullet>().direction.x; - - m_Mirrored.Add(go); - } - } - - private void OnTriggerExit2D(Collider2D collision) - { - GameObject go = collision.gameObject; - if (go && go.CompareTag("bullet") && m_Mirrored.Contains(go)) - { - m_Mirrored.Remove(go); - } - } -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestMirror.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestMirror.cs.meta deleted file mode 100644 index 6fdba29..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestMirror.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bfd61ceb1fbec0944a66ace63dcd8e02 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestMoveToTarget.cs b/AlienSurvival/Assets/Scripts/Test/TestMoveToTarget.cs deleted file mode 100644 index 4b5f637..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestMoveToTarget.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestMoveToTarget : MonoBehaviour -{ - public float speed = 1; - - Vector2 target; - - SpriteRenderer sprite; - - private void Start() - { - sprite = GetComponent<SpriteRenderer>(); - - } - - private void Update() - { - if (Input.GetButtonDown("Fire2")) - { - Vector3 screenPos = Input.mousePosition; - - target = Camera.main.ScreenToWorldPoint(screenPos); - //Debug.Log(target); - } - - Vector2 dir = Vector2.ClampMagnitude(target - (Vector2)transform.position, 1); - Vector3 move = dir * speed * Time.deltaTime; - transform.position = transform.position + move; - - float x = move.x; - if (x > 0) - { - sprite.flipX = false; - } - else if (x < 0) - { - sprite.flipX = true; - } - - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestMoveToTarget.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestMoveToTarget.cs.meta deleted file mode 100644 index 6f68458..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestMoveToTarget.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2283c114a7cfbd1429d3e2a0d5e6a957 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestPeaceMaker.cs b/AlienSurvival/Assets/Scripts/Test/TestPeaceMaker.cs deleted file mode 100644 index 11f76ba..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestPeaceMaker.cs +++ /dev/null @@ -1,314 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Events; - -public class TestPeaceMaker : MonoBehaviour -{ - - [SerializeField] private Transform m_Camera; - [SerializeField] private float m_Speed; - [SerializeField] private Transform m_Centre; - [SerializeField] private SpriteRenderer m_Arrow; - [SerializeField] private float m_ArrowRadius; - [SerializeField] private TestPeaceMakerBullet m_Bullet; - [SerializeField] private TestPeaceMakerGrenade m_Grenade; - [SerializeField] private Vector2 m_Zoom; - [SerializeField] private GameObject m_LaunchVfx; - [SerializeField] private Transform m_LaunchPoint; - [SerializeField] private TestB2 m_B2; - [SerializeField] private TestSpaceBeam m_SpaceBeam; - - private Vector3 zoomIn - { - get - { - Vector3 zin = new Vector3(m_Zoom.x, m_Zoom.x, 1); - return zin; - } - } - private Vector3 zoomOut - { - get - { - Vector3 zout = new Vector3(m_Zoom.y, m_Zoom.y, 1); - return zout; - } - } - - private TopDownShadowCaster m_Shadow; - - private SpriteRenderer m_SpriteRenderer; - private TopDownTransform m_Coord; - private Coroutine m_CoFire; - private Coroutine m_CoLaunchGrenade; - - private Vector3 m_PreMouse; - - private Vector2 m_AimDirection; - - private Vector3 m_TargetZoom; - - private enum ControlMode - { - Mouse, - Joystick, - } - private ControlMode m_ControlMode; - - void Start() - { - m_SpriteRenderer = GetComponent<SpriteRenderer>(); - m_Coord = GetComponent<TopDownTransform>(); - - m_ControlMode = ControlMode.Mouse; - m_AimDirection = Vector2.zero; - - m_TargetZoom = new Vector3(m_Zoom.x, m_Zoom.x, 1); - - m_Shadow = GetComponent<TopDownShadowCaster>(); - } - - void Update() - { - bool isMove = Move(); - - SetAim(); - - bool isFire = Fire(); - bool isGrenade = LaunchGrenade(); - bool isBeam = SpaceBeam(); - - CallB2(); - - CameraFollow(); - - CameraZoom(/*isMove ||*/ isFire || isGrenade /*|| isBeam*/); - } - - void CameraZoom(bool zout) - { - if(zout) - { - m_TargetZoom = zoomOut; - m_Camera.localScale = Vector3.Lerp(m_Camera.localScale, m_TargetZoom, 0.25f); - } - else - { - m_TargetZoom = zoomIn; - m_Camera.localScale = Vector3.Lerp(m_Camera.localScale, m_TargetZoom, /*Time.deltaTime * 2f*/0.25f); - } - } - - void CameraFollow() - { - Vector3 pos = m_Camera.position; - pos.x = m_Coord.x; - pos.y = m_Coord.y; - - if (Vector3.Distance(pos, m_Camera.position) > 0.1f) - { - m_Camera.position = Vector3.Lerp(m_Camera.position, pos, 3 * Time.deltaTime); - } - } - - bool Move() - { - float x = Input.GetAxisRaw("Horizontal"); - float y = Input.GetAxisRaw("Vertical"); - - bool isMove = x != 0 || y != 0; - - if (isMove) - { - Vector2 direction = new Vector2(x, y).normalized; - - Vector3 position = m_Coord.position; - position.x += direction.x * m_Speed * Time.deltaTime; - position.y += direction.y * m_Speed * Time.deltaTime; - - m_Coord.position = position; - - if (x > 0) - { - m_SpriteRenderer.flipX = false; - m_Shadow.Flip(false); - } - else if (x < 0) - { - m_SpriteRenderer.flipX = true; - m_Shadow.Flip(true); - } - } - - return isMove; - } - - void SetAim() - { - float xAxis = Input.GetAxisRaw("AimHorizontal"); - float yAxis = Input.GetAxisRaw("AimVertical"); - - bool bJoytick = xAxis != 0 || yAxis != 0; - - bool bMouse = (Input.mousePosition - m_PreMouse).magnitude > 0.01f; - m_PreMouse = Input.mousePosition; - - if(bJoytick) - { - m_ControlMode = ControlMode.Joystick; - } - if(bMouse) - { - m_ControlMode = ControlMode.Mouse; - } - - Vector2 centrePos = m_Centre.position; - Vector2 dir = Vector2.zero; - if (m_ControlMode == ControlMode.Mouse) - { - Vector2 camPos = GetCameraPosition(); - dir = (camPos - centrePos).normalized; - } - else - { - dir = new Vector2(xAxis, -yAxis).normalized; - } - - if(dir.magnitude > 0) - { - m_AimDirection = dir; - Vector2 arrowPos = centrePos + m_ArrowRadius * m_AimDirection; - m_Arrow.transform.position = new Vector3(arrowPos.x, arrowPos.y, m_Arrow.transform.position.z); - m_Arrow.transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(m_AimDirection.y, m_AimDirection.x) * Mathf.Rad2Deg); - } - } - - Vector2 GetCameraPosition() - { - Vector3 screenPos = Input.mousePosition; - Vector2 target = Camera.main.ScreenToWorldPoint(screenPos); - return target; - } - - bool Fire() - { - if (Input.GetButtonDown("Fire1") || (Input.GetAxis("GunTrigger") == 1)) - { - if (m_CoFire == null) - { - m_CoFire = StartCoroutine(coFire(0.1f)); - } - } - if (!Input.GetButton("Fire1") && (Input.GetAxis("GunTrigger") == 0)) - { - if(m_CoFire != null) - { - StopCoroutine(m_CoFire); - m_CoFire = null; - } - return false; - } - return true; - } - - bool LaunchGrenade() - { - if (Input.GetButtonDown("Fire2") || (Input.GetAxis("BombTrigger") == 1)) - { - if (m_CoLaunchGrenade == null) - { - m_CoLaunchGrenade = StartCoroutine(coLaunchGrenade(0.2f)); - } - } - if (!Input.GetButton("Fire2") && (Input.GetAxis("BombTrigger") == 0)) - { - if (m_CoLaunchGrenade != null) - { - StopCoroutine(m_CoLaunchGrenade); - m_CoLaunchGrenade = null; - } - return false; - } - return true; - } - - IEnumerator coFire(float interval) - { - while (true) - { - CreateBullet(m_AimDirection, 12f, 2f); - //CreateBullet(TestMathHelper.Rotate(m_AimDirection, 10 * Mathf.Deg2Rad), 12f, 2f); - //CreateBullet(TestMathHelper.Rotate(m_AimDirection, -10 * Mathf.Deg2Rad), 12f, 2f); - - yield return new WaitForSeconds(interval); - } - } - - TestPeaceMakerBullet CreateBullet(Vector2 dir, float speed, float lifeTime) - { - TestPeaceMakerBullet bullet = Instantiate<TestPeaceMakerBullet>(m_Bullet); - - bullet.transform.position = m_Arrow.transform.position + new Vector3(m_AimDirection.x, m_AimDirection.y, 0) * -0.3f; - - bullet.Set(dir, speed, lifeTime); - bullet.gameObject.SetActive(true); - - return bullet; - } - - - Vector3 GetRandomLaunchGrenadeDirection() - { - Vector3 dirOnPlane = Quaternion.Euler(0, 0, Random.Range(-15f, 15f)) * new Vector3(m_AimDirection.x, m_AimDirection.y, 0); - dirOnPlane = dirOnPlane.normalized; - Vector3 dir = new Vector3(dirOnPlane.x, dirOnPlane.y, Random.Range(0f, 1f)).normalized; - return dir.normalized; - } - - IEnumerator coLaunchGrenade(float interval) - { - while (true) - { - // grenade - TestPeaceMakerGrenade grenade = Instantiate<TestPeaceMakerGrenade>(m_Grenade); - Vector3 position = m_Coord.position + new Vector3(0, 0, 1.8f); - grenade.Set(position, GetRandomLaunchGrenadeDirection(), Random.Range(8f, 10f)); - grenade.gameObject.SetActive(true); - - // vfx - GameObject eff = Instantiate<GameObject>(m_LaunchVfx, this.transform); - eff.transform.position = m_LaunchPoint.transform.position; - eff.SetActive(true); - - yield return new WaitForSeconds(interval); - } - } - - void CallB2() - { - if(Input.GetButtonDown("Fire3")) - { - TestB2 b2 = Instantiate<TestB2>(m_B2); - - Vector3 pos3D = m_Coord.GetProjectedPosition(); - b2.Set(pos3D + new Vector3(-15, 0,0 ), pos3D + new Vector3(15, 0,0 ), 20f, 3f); - } - } - - bool SpaceBeam() - { - if (Input.GetButtonDown("SpaceBeam")) - { - TestSpaceBeam beam = Instantiate<TestSpaceBeam>(m_SpaceBeam); - - Vector3 pos3D = m_Coord.position; - beam.Set(pos3D + new Vector3(3, 0, 0)); - - TinyCountDown.Instance.Set("SpaceBeam", 0.1f); - return true; - } - return TinyCountDown.Instance.Get("SpaceBeam") > 0; - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestPeaceMaker.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestPeaceMaker.cs.meta deleted file mode 100644 index e8f0316..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestPeaceMaker.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e1b4df1c072214a4f947497f833281d9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerBullet.cs b/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerBullet.cs deleted file mode 100644 index 8229753..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerBullet.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestPeaceMakerBullet : MonoBehaviour -{ - - private Vector2 m_Direction; - - private float m_Speed; - - private float m_LifeTime; - - public void Set(Vector2 dir, float speed, float lifeTime) - { - m_Direction = dir; - m_Speed = speed; - m_LifeTime = lifeTime; - transform.rotation = Quaternion.Euler(0, 0, Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg); - } - - void Update() - { - m_LifeTime -= Time.deltaTime; - if(m_LifeTime <= 0) - { - Destroy(this.gameObject); - return; - } - - Vector2 move = m_Direction * m_Speed * Time.deltaTime; - - Vector3 pos = transform.position; - pos.x += move.x; - pos.y += move.y; - - transform.position = pos; - } - - private void OnTriggerEnter2D(Collider2D collision) - { - TestBucket bucket = collision.gameObject.GetComponent<TestBucket>(); - - if (bucket) - { - bucket.Broken(); - } - - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerBullet.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerBullet.cs.meta deleted file mode 100644 index c3bce5a..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerBullet.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cf74c7651403bc449b55858cefd8debb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerGrenade.cs b/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerGrenade.cs deleted file mode 100644 index 021eda7..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerGrenade.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestPeaceMakerGrenade : MonoBehaviour -{ - - [SerializeField] private float m_GravityScale = 1f; - - [SerializeField] private GameObject m_ExplosionEffect; - - private TopDownTransform m_Coords; - - private Vector3 GRAVITY = new Vector3(0, 0, -9.8f); - - private Vector3 m_Velocity; // x, y, fakeHeight - - /// <summary> - /// 设置初始参数,都在fake空间下 - /// </summary> - /// <param name="initPosition"></param> - /// <param name="initDirection"></param> - /// <param name="initSpeed"></param> - public void Set(Vector3 initPosition, Vector3 initDirection, float initSpeed) - { - m_Coords = GetComponent<TopDownTransform>(); - m_Coords.position = initPosition; - - m_Velocity = initDirection * initSpeed; - } - - private void Update() - { - Vector3 move = m_Velocity * Time.deltaTime; - - if(m_Velocity.magnitude > 0 && m_Coords.z + move.z >= 0) - { - m_Coords.x += move.x; - m_Coords.y += move.y; - m_Coords.z += move.z; - m_Velocity += GRAVITY * Time.deltaTime; - - transform.rotation *= Quaternion.Euler(0, 0, 100 * m_Velocity.magnitude * Time.deltaTime); - } - else - { - m_Velocity = Vector3.zero; - - this.gameObject.SetActive(false); - Destroy(this.gameObject); - PlayExplosion(); - } - } - - private void PlayExplosion() - { - GameObject exp = Instantiate<GameObject>(m_ExplosionEffect); - - TopDownTransform coord = exp.GetComponent<TopDownTransform>(); - coord.position = m_Coords.position; - - exp.GetComponent<TopDownSorting>().Sorting(); - - exp.SetActive(true); - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerGrenade.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerGrenade.cs.meta deleted file mode 100644 index 7b95df6..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestPeaceMakerGrenade.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 40fc919f136c67e41a3608549bab3217 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestPhysicsHelper.cs b/AlienSurvival/Assets/Scripts/Test/TestPhysicsHelper.cs deleted file mode 100644 index a1606f2..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestPhysicsHelper.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestPhysicsHelper : TestSingleton<TestPhysicsHelper> -{ - public TestPhysicsHelper() - { - } - - - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestPhysicsHelper.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestPhysicsHelper.cs.meta deleted file mode 100644 index 47ba3fc..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestPhysicsHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8031513d870e5e54e942664031efe406 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestRobot1.cs b/AlienSurvival/Assets/Scripts/Test/TestRobot1.cs deleted file mode 100644 index 367a661..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestRobot1.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestRobot1 : MonoBehaviour -{ - public Transform shadow; - - public float x = 0; - public float y = -0.628f; - public float z; // fake height - - public AnimationCurve curve; - public AnimationCurve curveX; - public AnimationCurve curveY; - - private void Update() - { - x = curveX.Evaluate(Time.time % 1f); - y = curveY.Evaluate(Time.time % 1f); - z = curve.Evaluate(Time.time % 1f); - - Vector3 pos = transform.position; - pos.x = x; - pos.y = y + z; - - transform.position = pos; - - pos.y = y; - shadow.transform.position = pos; - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestRobot1.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestRobot1.cs.meta deleted file mode 100644 index 554affe..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestRobot1.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 04de5fad9d56a774498cac6d58b2f231 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestSceneViewShaderHelper.cs b/AlienSurvival/Assets/Scripts/Test/TestSceneViewShaderHelper.cs deleted file mode 100644 index fca1bff..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSceneViewShaderHelper.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using UnityEngine; - -[ExecuteInEditMode] -public class TestSceneViewShaderHelper : MonoBehaviour -{ -#if UNITY_EDITOR - private int _isSceneViewID = Shader.PropertyToID("_IsSceneView"); - - public void OnEnable() - { - Camera.onPreRender += SetIfSceneViewCamera; - } - - public void OnDisable() - { - Camera.onPreRender -= SetIfSceneViewCamera; - } - - public void SetIfSceneViewCamera(Camera cam) - { - // Scene View camera is named "SceneCamera" - if (cam.gameObject.name == "SceneCamera") - { - Shader.EnableKeyword("SCENE_VIEW"); - Shader.SetGlobalFloat(_isSceneViewID, 1f); - } - // Inspector preview for materials, models, and prefabs is named "Preview Scene Camera" - // else if (cam.gameObject.name == "Preview Scene Camera") - // { - // Shader.EnableKeyword("SCENE_VIEW"); - // Shader.SetGlobalFloat(_isSceneViewID, 2f); - // } - // Otherwise this is a game view or other user camera - else - { - Shader.DisableKeyword("SCENE_VIEW"); - Shader.SetGlobalFloat(_isSceneViewID, 0f); - } - - // You can double check the camera names if something breaks in the future - // Debug.Log(cam); - } -#endif -} -
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/Test/TestSceneViewShaderHelper.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestSceneViewShaderHelper.cs.meta deleted file mode 100644 index 4b846fc..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSceneViewShaderHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8b08476505e1d804994534220f308b69 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestSeperator.cs b/AlienSurvival/Assets/Scripts/Test/TestSeperator.cs deleted file mode 100644 index d1819c0..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSeperator.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestSeperator : MonoBehaviour -{ - HashSet<GameObject> m_Seperated = new HashSet<GameObject>(); - - private void OnTriggerEnter2D(Collider2D collision) - { - GameObject go = collision.gameObject; - if (go && go.CompareTag("bullet") && !m_Seperated.Contains(go)) - { - //Debug.Log("seperate"); - - TestBeamBullet bullet1 = TestBeamBullet.Instantiate(go.GetComponent<TestBeamBullet>()); - bullet1.direction = Quaternion.Euler(0,0, 30) * bullet1.direction; - bullet1.enabled = true; - bullet1.gameObject.SetActive(true); - - TestBeamBullet bullet2 = TestBeamBullet.Instantiate(go.GetComponent<TestBeamBullet>()); - bullet2.direction = Quaternion.Euler(0, 0, -30) * bullet2.direction; - bullet2.enabled = true; - bullet2.gameObject.SetActive(true); - - m_Seperated.Add(go); - m_Seperated.Add(bullet1.gameObject); - m_Seperated.Add(bullet2.gameObject); - } - } - - private void OnTriggerExit2D(Collider2D collision) - { - GameObject go = collision.gameObject; - if (go.CompareTag("bullet") && m_Seperated.Contains(go)) - { - m_Seperated.Remove(go); - } - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestSeperator.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestSeperator.cs.meta deleted file mode 100644 index 58f5ccb..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSeperator.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ec780be79a9ec774b80c4ba5593c3a39 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestSingleton.cs b/AlienSurvival/Assets/Scripts/Test/TestSingleton.cs deleted file mode 100644 index d522653..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSingleton.cs +++ /dev/null @@ -1,20 +0,0 @@ -public class TestSingleton<T> where T : class, new() -{ - private static T _instance; - private static readonly object syslock = new object(); - - public static T getInstance() - { - if (_instance == null) - { - lock (syslock) - { - if (_instance == null) - { - _instance = new T(); - } - } - } - return _instance; - } -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/Test/TestSingleton.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestSingleton.cs.meta deleted file mode 100644 index 8035c63..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSingleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0e4486fb2a577bb4fa367c939cd96141 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestSorting.cs b/AlienSurvival/Assets/Scripts/Test/TestSorting.cs deleted file mode 100644 index 7a2cf54..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSorting.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestSorting : MonoBehaviour -{ - //private void Update() - //{ - // Vector3 pos = transform.position; - // pos.z = pos.y - 5; - - // if(transform.position.z != pos.z) - // { - // transform.position = pos; - // } - //} - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestSorting.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestSorting.cs.meta deleted file mode 100644 index 56c5ed0..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSorting.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c6f36e1896ea64642b621e21a00a6488 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestSortingByDepth.cs b/AlienSurvival/Assets/Scripts/Test/TestSortingByDepth.cs deleted file mode 100644 index 6e346ec..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSortingByDepth.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestSortingByDepth : MonoBehaviour -{ - - -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/Test/TestSortingByDepth.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestSortingByDepth.cs.meta deleted file mode 100644 index 934c164..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSortingByDepth.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 540605b09e537394f84b35d5bd77a505 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestSortingByY.cs b/AlienSurvival/Assets/Scripts/Test/TestSortingByY.cs deleted file mode 100644 index 59f44b7..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSortingByY.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestSortingByY : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestSortingByY.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestSortingByY.cs.meta deleted file mode 100644 index 5074c7f..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSortingByY.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a346df7f7a231e46bfeb3dbc1a63116 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestSpaceBeam.cs b/AlienSurvival/Assets/Scripts/Test/TestSpaceBeam.cs deleted file mode 100644 index b8ce07b..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSpaceBeam.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -/// <summary> -/// 太空射线 -/// </summary> -public class TestSpaceBeam : MonoBehaviour -{ - [SerializeField] private GameObject m_Beam; - - TopDownTransform m_Coord; - - List<GameObject> m_Beams = new List<GameObject>(); - - float m_RotateSpeed = 5f; - - float m_Radius = 1f; - - int count = 8; - - float m_CurrentAngle = 0; - - private void Awake() - { - m_Coord = GetComponent<TopDownTransform>(); - } - - public void Set(Vector3 posTDS) - { - m_Coord.position = posTDS; - - Vector3 groundPos = m_Coord.positionOnGround; - - for(int i = 0; i < count; ++i) - { - float angle = Mathf.PI * 2f / (float)count * i; - Vector3 pos = /*groundPos +*/ new Vector3(m_Radius * Mathf.Cos(angle), m_Radius * Mathf.Sin(angle), 0f); - GameObject beam = Instantiate<GameObject>(m_Beam, this.transform); - beam.GetComponent<TopDownTransform>().localPosition = pos; - beam.SetActive(true); - m_Beams.Add(beam); - } - } - - void Update() - { - m_CurrentAngle += m_RotateSpeed * Time.deltaTime; - - RotateBeams(m_CurrentAngle); - } - - /// <summary> - /// 旋转 - /// </summary> - /// <param name="angle">弧度</param> - void RotateBeams(float angle) - { - Vector3 groundPos = m_Coord.positionOnGround; - - for (int i = 0; i < m_Beams.Count; ++i) - { - float rad = angle + Mathf.PI * 2f / (float)count * i; - Vector3 pos = /*groundPos + */new Vector3(m_Radius * Mathf.Cos(rad), m_Radius * Mathf.Sin(rad), 0f); - m_Beams[i].GetComponent<TopDownTransform>().localPosition = pos; - } - - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestSpaceBeam.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestSpaceBeam.cs.meta deleted file mode 100644 index 3e008d2..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestSpaceBeam.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 345857a5337aab0458bb084b716eccdc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestTopDown2DTransform.cs b/AlienSurvival/Assets/Scripts/Test/TestTopDown2DTransform.cs deleted file mode 100644 index acfac68..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestTopDown2DTransform.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestTopDown2DTransform : MonoBehaviour -{ - public bool useGravity = false; - - public Vector3 position // x, y, h - { - get - { - Vector3 topdownPos = transform.position; - topdownPos.y -= h; - topdownPos.z = h; - return topdownPos; - } - set - { - h = value.z; - Vector3 realPos = transform.position; - realPos.y = value.y + h; - transform.position = realPos; - } - } - - public float x - { - get - { - return position.x; - } - } - - public float y - { - get - { - return position.y; - } - } - - public float h = 0; - - public float z - { - get - { - return transform.position.z; - } - } - - public float depth - { - get - { - return this.z; - } - } - - private float vy = 0; - - private void Update() - { - if (useGravity) - { - Vector3 pos = position; - vy += -9.8f * Time.deltaTime; - pos.z = Mathf.Max(pos.z + vy * Time.deltaTime, 0f); - if(pos.z == 0) - { - vy = 0; - } - position = pos; - } - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestTopDown2DTransform.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestTopDown2DTransform.cs.meta deleted file mode 100644 index b8279be..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestTopDown2DTransform.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 65a986ca41323a44c910b7d7660abf9c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Test/TestWaspRobot.cs b/AlienSurvival/Assets/Scripts/Test/TestWaspRobot.cs deleted file mode 100644 index 3a73d21..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestWaspRobot.cs +++ /dev/null @@ -1,145 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TestWaspRobot : MonoBehaviour -{ - [SerializeField] private TopDownTransform m_Follow; - - [SerializeField] private float m_MoveSpeed; - - private SpriteRenderer m_SpriteRenderer; - private TopDownTransform m_Coords; - - // wasp环绕 - [SerializeField] private float m_Radius; - - [SerializeField] private List<Sprite> m_Sprites; - - private bool m_Following; - - private float m_Angle; - - private float m_OrbitSpeed = 3f; - - enum State - { - None, - Move, - Orbit, - } - - private State m_State = State.None; - - private Coroutine m_Coroutine; - - private void Start() - { - m_SpriteRenderer = GetComponent<SpriteRenderer>(); - m_Coords = GetComponent<TopDownTransform>(); - - m_Following = false; - m_Angle = 0; - - ChangeState(State.Move); - } - - private void ChangeState(State state) - { - if(m_State != state) - { - //Debug.Log(m_State.ToString() + "->" + state.ToString()); - - if(m_Coroutine != null) - { - StopCoroutine(m_Coroutine); - } - m_State = state; - m_Coroutine = StartCoroutine("co" + m_State.ToString()); - } - } - - void Update() - { - - float distance = (m_Follow.positionOnGround - m_Coords.positionOnGround).magnitude; - m_Following = distance > m_Radius + 0.1f; - - if(m_Following) - { - ChangeState(State.Move); - } - else - { - ChangeState(State.Orbit); - } - - } - - IEnumerator coMove() - { - while (true) - { - if (m_Following) - { - Vector2 dir = (m_Follow.positionOnGround - m_Coords.positionOnGround).normalized; - - Vector2 posOnGround = m_Coords.positionOnGround; - posOnGround.x += m_MoveSpeed * Time.deltaTime * dir.x; - posOnGround.y += m_MoveSpeed * Time.deltaTime * dir.y; - - m_Coords.positionOnGround = posOnGround; - - float rad = GetAngleToTarget(); - - int index = GetSpriteIndex(rad); - SetSprite(index); - } - - yield return null; - } - } - - IEnumerator coOrbit() - { - m_Angle = GetAngleToTarget(); - - while (true) - { - m_Angle += Time.deltaTime * m_OrbitSpeed; - - Vector2 centre = m_Follow.positionOnGround; - centre += new Vector2(Mathf.Cos(m_Angle), Mathf.Sin(m_Angle)).normalized * m_Radius; - m_Coords.positionOnGround = Vector2.Lerp(m_Coords.positionOnGround, centre, 0.25f); - - int index = GetSpriteIndex(m_Angle); - SetSprite(index); - - yield return null; - } - } - - float GetAngleToTarget() - { - Vector2 posOnGround = m_Coords.positionOnGround; - Vector2 target = m_Follow.positionOnGround; - - Vector2 dir = (posOnGround - target).normalized; - - return Mathf.Atan2(dir.y, dir.x) + 2 * Mathf.PI * TestMathHelper.Check(dir.y < 0); - } - - // angle rad - int GetSpriteIndex(float rad) - { - int index = ((int)Mathf.Floor(((rad * Mathf.Rad2Deg) % 360) / 30)) % 12; - index = Mathf.Clamp(index, 0, m_Sprites.Count - 1); - return index; - } - - void SetSprite(int index) - { - m_SpriteRenderer.sprite = m_Sprites[index]; - } - -} diff --git a/AlienSurvival/Assets/Scripts/Test/TestWaspRobot.cs.meta b/AlienSurvival/Assets/Scripts/Test/TestWaspRobot.cs.meta deleted file mode 100644 index 9bd17eb..0000000 --- a/AlienSurvival/Assets/Scripts/Test/TestWaspRobot.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 37e797e79063cdf4883cf54509d9ddc3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/TopDown.meta b/AlienSurvival/Assets/Scripts/TopDown.meta deleted file mode 100644 index e81c7d0..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 42550630c8f16584fa0e12e91bd6db2a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/TopDown/Editor.meta b/AlienSurvival/Assets/Scripts/TopDown/Editor.meta deleted file mode 100644 index fa70114..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 80c8d9ba082ca27419e9d6e6bbb39f6d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/TopDown/Editor/TopDownTransformInspector.cs b/AlienSurvival/Assets/Scripts/TopDown/Editor/TopDownTransformInspector.cs deleted file mode 100644 index 1e4f6e0..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/Editor/TopDownTransformInspector.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - - -[CustomEditor(typeof(TopDownTransform))] -public class TopDownTransformInspector : Editor -{ - - TopDownTransform m_TopDownTransform; - - private void OnEnable() - { - m_TopDownTransform = target as TopDownTransform; - } - - private void OnDisable() - { - } - - public override void OnInspectorGUI() - { - base.OnInspectorGUI(); - } - - protected override void OnHeaderGUI() - { - base.OnHeaderGUI(); - } - - //https://answers.unity.com/questions/463207/how-do-you-make-a-custom-handle-respond-to-the-mou.html - private void OnSceneGUI() - { - Vector3 pos3d = m_TopDownTransform.GetProjectedPosition(); - - float arrowSize = 2f; - - Handles.color = Handles.xAxisColor; - m_TopDownTransform.x += EditorHandlesHelper.PositionArrow(pos3d + new Vector3(0, -m_TopDownTransform.z, 0), Vector3.right, 1f, arrowSize).x; - - Handles.color = Handles.yAxisColor; - m_TopDownTransform.y -= EditorHandlesHelper.PositionArrow(pos3d + new Vector3(0, -m_TopDownTransform.z, 0), Vector3.up, 1f, arrowSize).y; - - Handles.color = Handles.zAxisColor; - m_TopDownTransform.z -= EditorHandlesHelper.PositionArrow(pos3d /*+ new Vector3(-0.3f, 0, 0)*/, Vector3.up, 1.4f, arrowSize).y; - - } - -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/TopDown/Editor/TopDownTransformInspector.cs.meta b/AlienSurvival/Assets/Scripts/TopDown/Editor/TopDownTransformInspector.cs.meta deleted file mode 100644 index 09d9899..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/Editor/TopDownTransformInspector.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a1871ab3b887e6b41ba4a43777b53192 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs b/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs deleted file mode 100644 index ed17323..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -//[ExecuteInEditMode] -[DisallowMultipleComponent] -[RequireComponent(typeof(TopDownTransform))] -[RequireComponent(typeof(SpriteRenderer))] -public class TopDownShadowCaster : MonoBehaviour -{ - [SerializeField] private Color m_Color = new Color32(0,0,0, 58); - [SerializeField] private Vector2 m_Scale = new Vector2(1, 0.5f); - - private GameObject m_Shadow; - private SpriteRenderer m_ShadowRenderer; - - private TopDownTransform m_Coord; - private SpriteRenderer m_SpriteRenderer; - - public void Flip(bool flip) - { - m_ShadowRenderer.flipX = flip; - } - - private void Awake() - { - m_Coord = GetComponent<TopDownTransform>(); - m_SpriteRenderer = GetComponent<SpriteRenderer>(); - - // - for(int i = this.transform.childCount - 1; i >= 0 ; --i) - { - GameObject child = this.transform.GetChild(i).gameObject; - if (child.name == "shadow") - { - Destroy(child); - } - } - - if (m_Shadow == null) - { - m_Shadow = new GameObject("shadow"); -// m_Shadow.hideFlags = HideFlags.HideAndDontSave; - - m_Shadow.transform.SetParent(transform); - m_Shadow.transform.localScale = m_Scale; - - m_ShadowRenderer = m_Shadow.AddComponent<SpriteRenderer>(); - m_ShadowRenderer.color = m_Color; - m_ShadowRenderer.sprite = m_SpriteRenderer.sprite; - m_ShadowRenderer.sortingLayerName = "Shadow"; - } - } - - //private void Update() - private void LateUpdate() - { - m_ShadowRenderer.color = m_Color; - m_ShadowRenderer.sprite = m_SpriteRenderer.sprite; - - SetPosition(); - } - - public void SetPosition() - { - Vector3 pos = m_Coord.GetProjectedGroundPosition(); - m_Shadow.transform.position = pos; - } - -} diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs.meta b/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs.meta deleted file mode 100644 index 24ecda5..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f1ce201566412034c99687a8c5b94075 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 9 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownSorting.cs b/AlienSurvival/Assets/Scripts/TopDown/TopDownSorting.cs deleted file mode 100644 index 3ee2f0a..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownSorting.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[DisallowMultipleComponent] -[RequireComponent(typeof(SpriteRenderer))] -[RequireComponent(typeof(TopDownTransform))] -public class TopDownSorting : MonoBehaviour -{ - private SpriteRenderer m_SpriteRenderer; - private TopDownTransform m_Coord; - - private void Awake() - { - m_SpriteRenderer = GetComponent<SpriteRenderer>(); - m_Coord = GetComponent<TopDownTransform>(); - } - - private void Update() - { - Sorting(); - } - - public void Sorting() - { - if(m_SpriteRenderer == null) - { - m_SpriteRenderer = GetComponent<SpriteRenderer>(); - } - - if(m_Coord == null) - { - m_Coord = GetComponent<TopDownTransform>(); - } - - // 根据y设置sortOrder - m_SpriteRenderer.sortingOrder = (int)(-m_Coord.position.y * 100); - } - -} diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownSorting.cs.meta b/AlienSurvival/Assets/Scripts/TopDown/TopDownSorting.cs.meta deleted file mode 100644 index 33f3c75..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownSorting.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7a9f0293bd6e86e43bbbefc99b5e2722 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 8 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs b/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs deleted file mode 100644 index 103e214..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs +++ /dev/null @@ -1,224 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -#if UNITY_EDITOR -using UnityEditor; -#endif - -/// <summary> -/// 用于TopDown的Transform,支持模拟垂直高度,不允许旋转和缩放 -/// TopDownTransform的父节点必须也是TopDownTransform,Transform的父节点可以是TopDownTransform -/// </summary> -[ExecuteInEditMode] -[RequireComponent(typeof(Transform))] -public class TopDownTransform : MonoBehaviour -{ - // 右手系 - // z - // | - // | /y - // | / - // |/______x - - // x, y, z ( z = height) - [SerializeField] private Vector3 m_LocalPosition; - - // 只能绕一个虚拟轴旋转 - //[SerializeField] private float m_LocalRotation; - - // x, z - //[SerializeField] private Vector2 m_LocalScale; - - public Vector3 localPosition - { - get - { - return m_LocalPosition; - } - set - { - m_LocalPosition = value; - Project(); - } - } - - public float x - { - get - { - return m_LocalPosition.x; - } - set - { - m_LocalPosition.x = value; - Project(); - } - } - public float y - { - get - { - return m_LocalPosition.y; - } - set - { - m_LocalPosition.y = value; - Project(); - } - } - - public float z - { - get - { - return m_LocalPosition.z; - } - set - { - m_LocalPosition.z = value; - Project(); - } - } - - public float height - { - get - { - return z; - } - set - { - z = value; - } - } - - /// <summary> - /// 全局坐标 - /// </summary> - public Vector3 position - { - get - { - Vector3 pos = m_LocalPosition; - Transform self = this.transform; - while(self.parent != null) - { - TopDownTransform parentTransform = self.parent.GetComponent<TopDownTransform>(); - if (parentTransform == null) - { - Debug.LogError("Parent is not TopDownTransform"); - continue; - } - pos += parentTransform.m_LocalPosition; - self = self.parent; - } - return pos; - } - set - { - Vector3 pos = value; - Transform self = this.transform; - while (self.parent != null) - { - TopDownTransform parentTransform = self.parent.GetComponent<TopDownTransform>(); - if (parentTransform == null) - { - Debug.LogError("Parent is not TopDownTransform"); - continue; - } - pos -= parentTransform.m_LocalPosition; - self = self.parent; - } - m_LocalPosition = pos; - Project(); - } - } - - /// <summary> - /// 地表坐标(Topdown空间) - /// </summary> - public Vector3 positionOnGround - { - get - { - Vector3 pos = position; - pos.z = 0; - return pos; - } - set - { - Vector3 pos = position; - pos.x = value.x; - pos.y = value.y; - position = pos; - Project(); - } - } - - /// <summary> - /// “投影”,把坐标转换到Transform上 - /// </summary> - public void Project() - { - Vector3 pos = transform.localPosition; - pos.x = m_LocalPosition.x; - pos.y = m_LocalPosition.y + m_LocalPosition.z; - - transform.localPosition = pos; - } - - private void Awake() - { - SpriteRenderer sr = GetComponent<SpriteRenderer>(); - if (sr) - { - gameObject.AddOrGetComponent<TopDownSorting>(); - //gameObject.AddOrGetComponent<TopDownShadowCaster>(); - } - } - - private void Update() - { - Project(); - } - - #region 转换到Transform坐标 - public Vector3 GetProjectedPosition() - { - Vector3 posTD = position; - - Vector3 pos = new Vector3(); - pos.x = posTD.x; - pos.y = posTD.y + posTD.z; - pos.z = transform.position.z; - return pos; - } - - /// <summary> - /// 注意是在3D空间下 - /// </summary> - /// <returns></returns> - public Vector3 GetProjectedGroundPosition() - { - Vector3 posTD = position; - - Vector3 pos = new Vector3(); - pos.x = posTD.x; - pos.y = posTD.y; - pos.z = transform.position.z; - return pos; - } - #endregion - -#if UNITY_EDITOR - private void OnDrawGizmos() - { - Vector3 start = TopDownUtils.Project(position); - Vector3 end = TopDownUtils.Project(positionOnGround); - - Handles.DrawDottedLine(start, end, 1f); - Handles.DrawWireCube(end, new Vector3(0.1f, 0.1f, 0f)); - } -#endif - -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs.meta b/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs.meta deleted file mode 100644 index 2853e32..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2b1fbd797bf03674e9d1b81edc11e3f1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 5 - icon: {fileID: 2800000, guid: b7cb09ba3d43de2418ea93e3aa9cd4e4, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownUtils.cs b/AlienSurvival/Assets/Scripts/TopDown/TopDownUtils.cs deleted file mode 100644 index f42e123..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownUtils.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TopDownUtils -{ - - /// <summary> - /// 从TopDown空间转到3D空间下(TopDownTransform -> Transform) - /// </summary> - /// <param name="topDownCoord"></param> - /// <param name="z"></param> - /// <returns></returns> - public static Vector3 Project(Vector3 topDownCoord, float z = 0) - { - Vector3 pos = new Vector3(); - - pos.x = topDownCoord.x; - pos.y = topDownCoord.y + topDownCoord.z; - pos.z = z; - - return pos; - } - -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownUtils.cs.meta b/AlienSurvival/Assets/Scripts/TopDown/TopDownUtils.cs.meta deleted file mode 100644 index f60e1ef..0000000 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownUtils.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c60891307755afb4fb72033ed1cd557d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI.meta b/AlienSurvival/Assets/Scripts/UI.meta deleted file mode 100644 index 6c132b2..0000000 --- a/AlienSurvival/Assets/Scripts/UI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c4535944b9a836e4f82d8c62ee419f04 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/Common.meta b/AlienSurvival/Assets/Scripts/UI/Common.meta deleted file mode 100644 index eddb809..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Common.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5caa56ebd16dfc541a4d9cd54b9e8de7 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/Panel.meta b/AlienSurvival/Assets/Scripts/UI/Panel.meta deleted file mode 100644 index 508ebdd..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Panel.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 802ba1a461809b340be6bcdd0919371a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/Panel/PanelBase.cs b/AlienSurvival/Assets/Scripts/UI/Panel/PanelBase.cs deleted file mode 100644 index 421ff37..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Panel/PanelBase.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[DisallowMultipleComponent] -public class PanelBase : MonoBehaviour -{ - - public virtual void Set(object param) - { - } - - void Start() - { - - } - - void Update() - { - - } - - protected virtual void OnSecondUpdate() - { - - } - -} diff --git a/AlienSurvival/Assets/Scripts/UI/Panel/PanelBase.cs.meta b/AlienSurvival/Assets/Scripts/UI/Panel/PanelBase.cs.meta deleted file mode 100644 index 09e29ef..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Panel/PanelBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e770971f2e591fe4d872d6ce24941695 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/Panel/PanelEquipBar.cs b/AlienSurvival/Assets/Scripts/UI/Panel/PanelEquipBar.cs deleted file mode 100644 index 61f99e5..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Panel/PanelEquipBar.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class PanelEquipBar : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/AlienSurvival/Assets/Scripts/UI/Panel/PanelEquipBar.cs.meta b/AlienSurvival/Assets/Scripts/UI/Panel/PanelEquipBar.cs.meta deleted file mode 100644 index 8ef34db..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Panel/PanelEquipBar.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 19d70a7fc1ff38c4cb6ae04cf1530b7b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/Panel/PanelItemBar.cs b/AlienSurvival/Assets/Scripts/UI/Panel/PanelItemBar.cs deleted file mode 100644 index 04bb2d9..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Panel/PanelItemBar.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class PanelItemBar : PanelBase -{ - - - -} diff --git a/AlienSurvival/Assets/Scripts/UI/Panel/PanelItemBar.cs.meta b/AlienSurvival/Assets/Scripts/UI/Panel/PanelItemBar.cs.meta deleted file mode 100644 index 3925db5..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Panel/PanelItemBar.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b3e9f15745561dd4f9119ac8f893dbfc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/Panel/PanelLevelBar.cs b/AlienSurvival/Assets/Scripts/UI/Panel/PanelLevelBar.cs deleted file mode 100644 index 74fbbd9..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Panel/PanelLevelBar.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public class PanelLevelBar : PanelBase -{ - public Image m_LevelImage; - public Text m_TextLevel; - - public override void Set(object param) - { - - } - -} diff --git a/AlienSurvival/Assets/Scripts/UI/Panel/PanelLevelBar.cs.meta b/AlienSurvival/Assets/Scripts/UI/Panel/PanelLevelBar.cs.meta deleted file mode 100644 index 9a7779d..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Panel/PanelLevelBar.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2be251ff144c0a74c807ebb0d7123c51 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/UIManager.cs b/AlienSurvival/Assets/Scripts/UI/UIManager.cs deleted file mode 100644 index a9c85c0..0000000 --- a/AlienSurvival/Assets/Scripts/UI/UIManager.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public partial class UIManager : Singleton<UIManager> -{ - - public UIManager() - { - } - - - -} diff --git a/AlienSurvival/Assets/Scripts/UI/UIManager.cs.meta b/AlienSurvival/Assets/Scripts/UI/UIManager.cs.meta deleted file mode 100644 index 6a1443f..0000000 --- a/AlienSurvival/Assets/Scripts/UI/UIManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 112b672f814aaa44c8a13e7546a37e34 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/UIManager_Panels.cs b/AlienSurvival/Assets/Scripts/UI/UIManager_Panels.cs deleted file mode 100644 index e3914d3..0000000 --- a/AlienSurvival/Assets/Scripts/UI/UIManager_Panels.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public enum PanelType -{ - None, - - PanelLevelBar, -} - -public partial class UIManager : Singleton<UIManager> -{ - private Dictionary<PanelType, string> m_Panels = new Dictionary<PanelType, string>(); - - void SetPanels() - { - m_Panels.Add(PanelType.PanelLevelBar, ""); - } - - void OpenPanel(PanelType type, object param) - { - - } - -} diff --git a/AlienSurvival/Assets/Scripts/UI/UIManager_Panels.cs.meta b/AlienSurvival/Assets/Scripts/UI/UIManager_Panels.cs.meta deleted file mode 100644 index 3e05678..0000000 --- a/AlienSurvival/Assets/Scripts/UI/UIManager_Panels.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6f4b4e5ebd1f46448aa13ba17678f09c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/Widget.meta b/AlienSurvival/Assets/Scripts/UI/Widget.meta deleted file mode 100644 index c0a26ea..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Widget.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bcd93f44480b22b4a9062a12135fc4c8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/UI/Widget/UIButton.cs b/AlienSurvival/Assets/Scripts/UI/Widget/UIButton.cs deleted file mode 100644 index 616b69d..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Widget/UIButton.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class UIButton : MonoBehaviour -{ - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } -} diff --git a/AlienSurvival/Assets/Scripts/UI/Widget/UIButton.cs.meta b/AlienSurvival/Assets/Scripts/UI/Widget/UIButton.cs.meta deleted file mode 100644 index 41e16d0..0000000 --- a/AlienSurvival/Assets/Scripts/UI/Widget/UIButton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 44f10b713a72b6d43a08cab3b90d6939 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit.meta b/AlienSurvival/Assets/Scripts/Unit.meta deleted file mode 100644 index 88ae4af..0000000 --- a/AlienSurvival/Assets/Scripts/Unit.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 20ed300e486cd294f8270cf7e5da1a80 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Crew.meta b/AlienSurvival/Assets/Scripts/Unit/Crew.meta deleted file mode 100644 index 5f3ee2c..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Crew.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 830ea73e55463584989d031951c697cc -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Crew/Captain.meta b/AlienSurvival/Assets/Scripts/Unit/Crew/Captain.meta deleted file mode 100644 index 895a619..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Crew/Captain.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9668cc289cdd6a6418701280b3a069ae -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Crew/Commander.meta b/AlienSurvival/Assets/Scripts/Unit/Crew/Commander.meta deleted file mode 100644 index 7c30320..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Crew/Commander.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d1aaba11f56306c4886bd1493c551bb8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Crew/CowBoy.meta b/AlienSurvival/Assets/Scripts/Unit/Crew/CowBoy.meta deleted file mode 100644 index 3a77cbf..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Crew/CowBoy.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e949a0b45780f29468c197512dda33ce -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Crew/Engineer.meta b/AlienSurvival/Assets/Scripts/Unit/Crew/Engineer.meta deleted file mode 100644 index 1d96208..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Crew/Engineer.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ae700a8de34b44a46ae4abd28758c186 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Crew/Messenger.meta b/AlienSurvival/Assets/Scripts/Unit/Crew/Messenger.meta deleted file mode 100644 index 5bb4bb2..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Crew/Messenger.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 82605833fec9b254a9c8f02acdd5d8ed -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Crew/Professor.meta b/AlienSurvival/Assets/Scripts/Unit/Crew/Professor.meta deleted file mode 100644 index dd53146..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Crew/Professor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 65cd3bae8bee1674fa2bee61b70bdfd7 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Crew/V1.meta b/AlienSurvival/Assets/Scripts/Unit/Crew/V1.meta deleted file mode 100644 index 1e5cd83..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Crew/V1.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: edca9b39c2e2ec546b935ad9a7151433 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Crew/V2.meta b/AlienSurvival/Assets/Scripts/Unit/Crew/V2.meta deleted file mode 100644 index 4770a33..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Crew/V2.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4245a0b35b1bc66438a3d3fd80d63e48 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Unit/Enemy.meta b/AlienSurvival/Assets/Scripts/Unit/Enemy.meta deleted file mode 100644 index 76fd12f..0000000 --- a/AlienSurvival/Assets/Scripts/Unit/Enemy.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b7b0f093dc957ce4886c6cf59b32e9da -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Utils.meta b/AlienSurvival/Assets/Scripts/Utils.meta deleted file mode 100644 index 8866322..0000000 --- a/AlienSurvival/Assets/Scripts/Utils.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c8b3daee7311a114c9b54fedba31b631 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs b/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs deleted file mode 100644 index 6ae7d87..0000000 --- a/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class GameLoop : Singleton<GameLoop> -{ - - public GameLoop() - { - indexOfUpdate = 0; - } - - public int indexOfUpdate { get; private set; } = 0; - - public void Update() - { - ++indexOfUpdate; - } - -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs.meta b/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs.meta deleted file mode 100644 index fa6fa0e..0000000 --- a/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5ce4c552f3823e842853a52a52d3cc3b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: -1100 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Utils/GameObjectUtils.cs b/AlienSurvival/Assets/Scripts/Utils/GameObjectUtils.cs deleted file mode 100644 index 416f097..0000000 --- a/AlienSurvival/Assets/Scripts/Utils/GameObjectUtils.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class GameObjectUtils -{ - - public static T AddOrGetComponent<T>(this GameObject go) where T : MonoBehaviour - { - T comp = go.GetComponent<T>(); - if(comp == null) - { - comp = go.AddComponent<T>(); - } - return comp; - } - -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/Utils/GameObjectUtils.cs.meta b/AlienSurvival/Assets/Scripts/Utils/GameObjectUtils.cs.meta deleted file mode 100644 index eb4979a..0000000 --- a/AlienSurvival/Assets/Scripts/Utils/GameObjectUtils.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a2cfaa149609631408d5f2f301a232fe -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Utils/Singleton.cs b/AlienSurvival/Assets/Scripts/Utils/Singleton.cs deleted file mode 100644 index d7aad49..0000000 --- a/AlienSurvival/Assets/Scripts/Utils/Singleton.cs +++ /dev/null @@ -1,24 +0,0 @@ -public class Singleton<T> where T : class, new() -{ - private static T _instance; - private static readonly object syslock = new object(); - - public static T Instance - { - get - { - if (_instance == null) - { - lock (syslock) - { - if (_instance == null) - { - _instance = new T(); - } - } - } - return _instance; - - } - } -}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Scripts/Utils/Singleton.cs.meta b/AlienSurvival/Assets/Scripts/Utils/Singleton.cs.meta deleted file mode 100644 index ff0aab9..0000000 --- a/AlienSurvival/Assets/Scripts/Utils/Singleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1b80a3ccdebef4b4db85130a4bde2d00 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/AlienSurvival/Assets/Scripts/Utils/TinyCountDown.cs b/AlienSurvival/Assets/Scripts/Utils/TinyCountDown.cs deleted file mode 100644 index dbeae55..0000000 --- a/AlienSurvival/Assets/Scripts/Utils/TinyCountDown.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Linq; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class TinyCountDown :Singleton<TinyCountDown> -{ - - private Dictionary<string, float> m_CountDown = new Dictionary<string, float>(); - public TinyCountDown() - { - } - - public void Set(string key, float time) - { - if (!m_CountDown.ContainsKey(key)) - { - m_CountDown.Add(key, time); - } - else - { - m_CountDown[key] = time; - } - } - - public float Get(string key) - { - if (m_CountDown.ContainsKey(key)) - { - return m_CountDown[key]; - } - return 0; - } - - public void Update() - { - List<string> keys = new List<string>(m_CountDown.Keys); - foreach (var key in keys) - { - m_CountDown[key] -= Time.deltaTime; - if(m_CountDown[key] <= 0) - { - m_CountDown.Remove(key); - } - } - - } -} diff --git a/AlienSurvival/Assets/Scripts/Utils/TinyCountDown.cs.meta b/AlienSurvival/Assets/Scripts/Utils/TinyCountDown.cs.meta deleted file mode 100644 index c9f5545..0000000 --- a/AlienSurvival/Assets/Scripts/Utils/TinyCountDown.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: de0d1a4a5baf48a4083e5d7f457ea8b0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: |