In my 3d game i have a jumpscare that is a 2d Sprite and i have this script but it wont work! can anyone tune it up for my application or give me some pointers please i need to make the object show up for 3 seconds 18 seconds into pressing E but not an animation (That was a failed attempt to make it work
var Figure : GameObject;
var Moveup : Animation;
function Start () {
if (Input.GetKeyDown ("e"))
yield WaitForSeconds (18.0);
GameObject.Find("Figure").GetComponent.<Animation>().Play("Moveup");
yield WaitForSeconds (2.5);
}
But i also have this script attached to the same object
var radioInRange;
var radioActivated;
var radioSound : AudioClip;
public var guiSkin : GUISkin;
private var hasPlayed = false;
function OnTriggerEnter (c : Collider)
{
radioInRange = true;
}
function OnTriggerExit (c : Collider)
{
radioInRange = false;
}
function OnGUI ()
{
if(radioInRange == true)
{
GUI.skin = guiSkin;
GUI.Label (Rect (Screen.width/2-50, Screen.height/2-55, 120, 50), "Turn on radio");
}
}
function Update ()
{
if (radioInRange == true)
{
if (Input.GetKeyDown ("e"))
{
if(!hasPlayed)
{
AudioSource.PlayClipAtPoint(radioSound, transform.position);
hasPlayed = true;
}
}
}
}