//Jimmy Vegas Unity Tutorial //These scripts will rotate your sky and control the door //sky script using System.Collections; using System.Collections.Generic; using UnityEngine; public class SkyRotation : MonoBehaviour { public float RotateSpeed = 0.5f; void Update () { RenderSettings.skybox.SetFloat("_Rotation", Time.time * RotateSpeed); } } //door script using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CreakyDoorOpen : MonoBehaviour { public float TheDistance; public GameObject ActionDisplay; public GameObject TheDoor; public AudioSource CreakSound; void Update () { TheDistance = PlayerPrefs.GetFloat("TheCasting"); } void OnMouseOver() { if (TheDistance <= 3) { ActionDisplay.GetComponent().text = "Open Door"; ActionDisplay.SetActive(true); } if (Input.GetButtonDown("Action")) { if (TheDistance <= 3) { GetComponent().enabled = false; ActionDisplay.SetActive(false); TheDoor.GetComponent().Play("OpenDoorAnim"); CreakSound.Play(); } } } void OnMouseExit() { ActionDisplay.SetActive(false); } }