From c7de0419a8924ae7333bcaed39e797d7c9fc1e69 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 22 Apr 2022 19:22:09 +0800 Subject: * change folder of resources --- .../Assets/Test/Scripts/TestPeaceMakerGrenade.cs | 67 ---------------------- 1 file changed, 67 deletions(-) delete mode 100644 AlienSurvival/Assets/Test/Scripts/TestPeaceMakerGrenade.cs (limited to 'AlienSurvival/Assets/Test/Scripts/TestPeaceMakerGrenade.cs') diff --git a/AlienSurvival/Assets/Test/Scripts/TestPeaceMakerGrenade.cs b/AlienSurvival/Assets/Test/Scripts/TestPeaceMakerGrenade.cs deleted file mode 100644 index 021eda7..0000000 --- a/AlienSurvival/Assets/Test/Scripts/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 - - /// - /// 设置初始参数,都在fake空间下 - /// - /// - /// - /// - public void Set(Vector3 initPosition, Vector3 initDirection, float initSpeed) - { - m_Coords = GetComponent(); - 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(m_ExplosionEffect); - - TopDownTransform coord = exp.GetComponent(); - coord.position = m_Coords.position; - - exp.GetComponent().Sorting(); - - exp.SetActive(true); - } - -} -- cgit v1.1-26-g67d0