using UnityEngine;
public class EC : MonoBehaviour
{
private bool _collisionSet;
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Cube" && !_collisionSet)
{
{
for (int i = collision.transform.childCount - 1; i >= 0; i--)
Transform child = collision.transform.GetChild(i);
child.gameObject.AddComponent();
child.gameObject.GetComponent.AddExplosionForce(70f, Vector3.up, 5f);
child.SetParent(null)
}
Destroy(collision.gameObject);
_collisionSet = true
}
}
}
-
Вопрос задан
-
188 просмотров