I am working on a collision-based button script (is there any other kind?), and I am trying to work out how to use smooth transitions in the animation, sort of like a fade between the two, otherwide if i enter and exit then enter quickly, the animation playing jumps to the ontriggerenter animation instead of smoothly transitioning between.
Here is the code:
var door : GameObject;
//var linkage : GameObject;
var soundClipButton : AudioClip;
//var soundDoorOpen : AudioClip;
//var soundDoorClose : AudioClip;
var Open : boolean = false;
function Start () {
Open = false;
}
function OnTriggerEnter (other : Collider)
{
if (!Open)
{
door.animation.Play("Open");
animation.Play("down animation");
audio.PlayOneShot(soundClipButton);
}
}
function OnTriggerExit (other : Collider)
{
if (Open)
{
door.animation.Play("Close");
animation.Play("up animation");
audio.PlayOneShot(soundClipButton);
}
}