init: version 1
This commit is contained in:
21
Assets/Prefabs/Spawnpoint/Scripts/RespawnZone.cs
Normal file
21
Assets/Prefabs/Spawnpoint/Scripts/RespawnZone.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// RespawnPlane is a trigger zone that respawns the player or cube
|
||||
/// when they enter the zone.
|
||||
/// </summary>
|
||||
public class RespawnPlane : MonoBehaviour
|
||||
{
|
||||
[Header("Configuration")]
|
||||
public Spawnpoint spawnpoint;
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other) {
|
||||
if (other.gameObject.CompareTag("Player")) {
|
||||
spawnpoint.Respawn();
|
||||
}
|
||||
|
||||
if (other.gameObject.CompareTag("Cube")) {
|
||||
other.GetComponent<CubeController>().Respawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user