projectEli/Assets/NeoFPS/Samples/SinglePlayer/Scenes/FeatureDemos/Parkour/OutOfBoundsRespawn.cs
2022-11-06 20:28:33 -05:00

22 lines
686 B
C#

using NeoFPS.SinglePlayer;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace NeoFPS.Samples.SinglePlayer
{
public class OutOfBoundsRespawn : MonoBehaviour
{
[SerializeField] private float m_RespawnHeight = -25f;
private void Update()
{
var gameMode = FpsGameMode.current as FpsSoloGameMinimal;
if (gameMode != null && gameMode.player != null && gameMode.playerCharacter != null)
{
if (gameMode.playerCharacter.motionController.localTransform.position.y < m_RespawnHeight)
gameMode.Respawn(gameMode.player);
}
}
}
}