diff options
Diffstat (limited to 'AlienSurvival/Assets/Scripts')
24 files changed, 0 insertions, 748 deletions
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/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/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/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 91fb9e9..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, 1f); - } - } - -} 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/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/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/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: |