TO SQUASH: A lot of things.

This commit is contained in:
2026-08-05 04:52:06 -04:00
parent 1c00bebb40
commit a9db378127
111 changed files with 63162 additions and 6833 deletions
+40
View File
@@ -0,0 +1,40 @@
using UnityEngine;
public class Debris : MonoBehaviour
{
protected Vector2 speed;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
speed = new Vector2(Random.Range(-0.05f, 0.05f), Random.Range(-0.05f, 0.05f)).normalized * 0.05f;
}
// Update is called once per frame
void FixedUpdate()
{
transform.Translate(speed);
}
public void AnimationFinished()
{
Destroy(gameObject);
}
void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Wall"))
{
ContactPoint2D contact = collision.GetContact(0);
speed = Vector2.Reflect(speed, contact.normal);
}
else
{
Physics2D.IgnoreCollision(
gameObject.GetComponent<Collider2D>(),
collision.gameObject.GetComponent<Collider2D>(),
true
);
}
}
}