mirror of
https://github.com/ConjureETS/MTI860_VR_Multi_Controller.git
synced 2026-03-24 12:31:15 +00:00
75 lines
1.6 KiB
C#
75 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using static MovementGen;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class Executable : MonoBehaviour
|
|
{
|
|
public Timer timer;
|
|
public string NextScene;
|
|
public TextMesh text;
|
|
public bool IsQuickTeleport = false;
|
|
public bool noMovementChange = true;
|
|
public ChoiceOfMovement nextMouv;
|
|
|
|
void Start()
|
|
{
|
|
//Set the tag of this GameObject to Player
|
|
gameObject.tag = "Target";
|
|
if(noMovementChange)
|
|
text.text = "";
|
|
else
|
|
text.text = nextMouv.ToString();
|
|
}
|
|
|
|
public void Execute()
|
|
{
|
|
if (timer)
|
|
{
|
|
timer.Stop();
|
|
}
|
|
if (!noMovementChange)
|
|
{
|
|
PlayerPrefs.SetInt("mouvement", (int)nextMouv);
|
|
}
|
|
if (IsQuickTeleport)
|
|
{
|
|
SceneManager.LoadScene(NextScene);
|
|
}
|
|
else
|
|
{
|
|
StartCoroutine("TimerExecute");
|
|
}
|
|
}
|
|
private int count = 0;
|
|
IEnumerator TimerExecute()
|
|
{
|
|
count = 6;
|
|
while (true)
|
|
{
|
|
count--;
|
|
if (text != null) {
|
|
if (count >= 0)
|
|
text.text = "" + count;
|
|
else
|
|
text.text = "Done";
|
|
}
|
|
|
|
|
|
yield return new WaitForSeconds(1f);
|
|
if (count <= 0)
|
|
{
|
|
SceneManager.LoadScene(NextScene);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
Debug.Log("Demon detected the colision");
|
|
}
|
|
}
|