Initial commit

This commit is contained in:
2026-02-18 12:00:34 +00:00
commit 5d353cf5fa
1947 changed files with 335322 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
using UnityEngine;
public class Explosion : MonoBehaviour
{
public Vector3 explosionPosition;
private ParticleSystem m_ParticleSystem;
private Rigidbody[] m_Rigidbodies;
private bool m_Exploded;
private bool m_Destroyed;
private void Awake()
{
m_ParticleSystem = GetComponent<ParticleSystem>();
m_Rigidbodies = gameObject.GetComponentsInChildren<Rigidbody>();
}
private void OnEnable()
{
m_ParticleSystem.Play();
m_Exploded = false;
}
private void OnDisable()
{
m_ParticleSystem.Stop();
}
private void Update()
{
if (!m_ParticleSystem.isPlaying && !m_Destroyed)
{
m_Destroyed = true;
Destroy(gameObject);
}
}
private void FixedUpdate()
{
if (!m_Exploded)
{
for (var i = 0; i < m_Rigidbodies.Length; i++)
{
var body = m_Rigidbodies[i];
body.AddExplosionForce(10.0f, explosionPosition, 0.5f, 0.0f, ForceMode.Impulse);
}
m_Exploded = true;
}
}
}