mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-03-25 19:24:31 -05:00
-Updated Terrains for plains, valley -Added respawn mechanic -Added PlayerMovement respawn support
18 lines
534 B
C#
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();
|
|
}
|
|
}
|
|
}
|