GeoJam2021/Assets/Scripts/Death.cs

19 lines
445 B
C#
Raw Normal View History

2021-07-20 20:10:12 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Death : MonoBehaviour
{
2021-07-20 20:36:16 +02:00
void Start() {
2021-07-20 20:10:12 +02:00
}
2021-07-20 20:36:16 +02:00
private void OnCollisionEnter2D (Collision2D collisionInfo)
{
2021-07-20 21:40:21 +02:00
if (collisionInfo.collider.name == "Player") {
collisionInfo.collider.transform.position = Vector3.zero;
collisionInfo.collider.GetComponent<Rigidbody2D>().velocity = Vector3.zero;
}
2021-07-20 20:10:12 +02:00
}
}