You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
785 B
C#
27 lines
785 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace Autohand.Demo{
|
|
public class PlayerFallCatcher : MonoBehaviour{
|
|
Vector3 startPos;
|
|
|
|
void Start(){
|
|
if(AutoHandPlayer.Instance != null) {
|
|
startPos = AutoHandPlayer.Instance.transform.position;
|
|
if(!SceneManager.GetActiveScene().name.ToLower().Contains("demo"))
|
|
enabled = false;
|
|
}
|
|
}
|
|
|
|
void FixedUpdate() {
|
|
if(AutoHandPlayer.Instance != null) {
|
|
if(AutoHandPlayer.Instance.transform.position.y < -10f) {
|
|
AutoHandPlayer.Instance.SetPosition(startPos);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|