mirror of
https://github.com/nick7ass/NNMDETGroupProject.git
synced 2024-12-12 13:32:43 +01:00
68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class BoundEarthScript : MonoBehaviour
|
|
{
|
|
public bool seedHasAppeared = false;
|
|
|
|
public bool narrationHasFinished = false;
|
|
public bool narrationHasStarted = false;
|
|
|
|
public AudioSource audioSource;
|
|
public AudioClip narrationClip;
|
|
public AudioClip narrationClipTwo;
|
|
|
|
public GameObject earthObjectToCollect;
|
|
|
|
public GameObject earthInstructionUI;
|
|
|
|
private bool objectHasBeenCollected = false;
|
|
|
|
|
|
//Boundary control
|
|
public BoundaryControlScript boundControl;
|
|
|
|
//Use Yield return to like not make it start instantly????
|
|
public void OnTriggerEnter(Collider other)
|
|
{
|
|
|
|
if (other.CompareTag("BoundHMD") && !narrationHasFinished && !narrationHasStarted) //
|
|
{
|
|
//Removing other bounds temporarily
|
|
boundControl.TempRemoveBoundary("Earth");
|
|
|
|
//Play narration
|
|
StartCoroutine(NarrationAndSignalCoroutine());
|
|
}
|
|
}
|
|
|
|
IEnumerator NarrationAndSignalCoroutine()
|
|
{
|
|
narrationHasStarted = true;
|
|
audioSource.PlayOneShot(narrationClip);
|
|
|
|
yield return new WaitForSeconds(narrationClip.length);
|
|
narrationHasFinished = true;
|
|
earthInstructionUI.SetActive(true);
|
|
}
|
|
|
|
public void collectForce() {
|
|
if (narrationHasFinished && !seedHasAppeared)
|
|
{
|
|
earthObjectToCollect.SetActive(true);
|
|
audioSource.PlayOneShot(narrationClipTwo);
|
|
seedHasAppeared = true;
|
|
}
|
|
}
|
|
|
|
public void stationCompleted()
|
|
{
|
|
earthInstructionUI.SetActive(false);
|
|
earthObjectToCollect.SetActive(false);
|
|
//boundControl.ReactivateBoundary();
|
|
boundControl.RemoveBoundary("Earth");
|
|
}
|
|
|
|
}
|