added comments and organized project files
This commit is contained in:
14
Assets/Scripts/Game/HatRespawn.cs
Normal file
14
Assets/Scripts/Game/HatRespawn.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class HatRespawn : MonoBehaviour
|
||||
{
|
||||
void OnTriggerEnter2D(Collider2D collision) // Respawns the hat to the hat spawn position if it falls out of bounds
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Platformer Hazard"))
|
||||
{
|
||||
transform.position = GameManager.Instance.hatSpawnPosition;
|
||||
GetComponent<Rigidbody2D>().linearVelocity = Vector2.zero;
|
||||
transform.rotation = Quaternion.identity;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user