summaryrefslogtreecommitdiff
path: root/AlienSurvival/Assets/Test/Scripts/TestGrenade.cs
diff options
context:
space:
mode:
Diffstat (limited to 'AlienSurvival/Assets/Test/Scripts/TestGrenade.cs')
-rw-r--r--AlienSurvival/Assets/Test/Scripts/TestGrenade.cs107
1 files changed, 0 insertions, 107 deletions
diff --git a/AlienSurvival/Assets/Test/Scripts/TestGrenade.cs b/AlienSurvival/Assets/Test/Scripts/TestGrenade.cs
deleted file mode 100644
index a1434d8..0000000
--- a/AlienSurvival/Assets/Test/Scripts/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);
- //}
- }
-
-}