/* * This file is part of the "House of the Future" showcase project by M2H (http://www.M2H.nl) * The original author of this code Mike Hergaarden. * Feel free to use this code for your own projects, drop me a line if you made something exciting! */ //Only plays the movie when inside the trigger #pragma strict function OnTriggerEnter (other : Collider) { if(other.transform.tag=="MainCamera"){ (renderer.material.mainTexture as MovieTexture).Play(); audio.volume=0; audio.Play(); yield WaitForSeconds(0.3); audio.volume=1; } } function OnTriggerExit (other : Collider) { if(other.transform.tag=="MainCamera"){ (renderer.material.mainTexture as MovieTexture).Pause(); audio.Stop(); } }