TheKingsRace/Assets/Scripts/Environment/Pitfall.cs
Vincent Wheat 10a9f8d1ca Updates to terrain sculpting
-Updated Terrains for plains, valley
-Added respawn mechanic
-Added PlayerMovement respawn support
2021-12-01 13:51:46 -06:00

18 lines
534 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pitfall : MonoBehaviour
{
public Vector3 RespawnPoint; //Where player will respawn to, set in GUI
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player")) //If runner enters the trigger cancel momentum, disable controls, and move to set respawn point
{
other.transform.position = RespawnPoint;
other.GetComponent<PlayerMovement>().CancelMomentum();
}
}
}