Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » FREE Project Downloads & Recources » Scripts » triggered animation script (free)

triggered animation script (free)

View previous topic View next topic Go down  Message [Page 1 of 1]

1 triggered animation script (free) on Fri Dec 26, 2014 4:35 pm

zino2k


Member [Lv. 2]
Member [Lv. 2]
this is triggered animation script enjoy

dont forget subscribe here [You must be registered and logged in to see this link.]


var chestSound : AudioClip; //chest opening sound clip goes here
var treasureChest : GameObject; //treasure chest prefab goes here

function OnTriggerEnter (col : Collider) {

if(col.gameObject.tag == "Player") { //checks to see that our character controller with tag "Player" has entered the trigger
AudioSource.PlayClipAtPoint(chestSound, transform.position); //plays our soundclip at position of collider/trigger
treasureChest.animation.Play(); //plays the default animation applied to our treasureChest model
Destroy(gameObject);// destroys the gameobject that has this script, so our collider in this case

}
}

View user profile https://www.youtube.com/user/zinofxmovie/videos

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum