Hello Unity3D.I have a question about the OnTriggerEnter and Tags.Is having 100 OnTriggerEnter and Tags on a player too much?The reason why i ask this question is the fact that i want to make the character that get hits depending on the tag that they character gets hit with plays a certain animation.For example.my character gets hit with a fireball and the fireball has a tag name fire.Therefore the character that gets hit with the fireball that is tagged fire the character plays animation called "fire hit"and if the character was hit with a water balloon and the water balloon was tagged water the character that got hit with the water balloon would play an animation called “water hit”.Is there a way that i can make one script that can play OnTriggerEnter that depending on the tags of the players or objects that the character gets hit with plays a certain animation depending on the tag.If so.Can anyone please tell me how?
P.S This is an example
#pragma strict
var setOnFire : ParticleSystem;
var player :Transform;
var speed = 30;
var pushPower = 2.0;
var anim: String;
var cam: Camera;
function OnTriggerEnter (Col : Collider)
{
if (Col.tag == "Fist")
{
// Default hit animation
var anim : String = "Hit1";
// Animation related to player's animation
if(Col.animation.IsPlaying("Gigantic_FireBall_Part_2"))
anim = "Shinzuroken_Hit";
animation.Play(anim);
cam.animation.Play("Hit Animation Camera");
cam.animation["Hit Animation Camera"].speed = 2;
setOnFire.Play();
}
}
function OnTriggerExit (other : Collider)
{
if (other.tag == "Player")
{
cam.animation.Play("Normal Camera");
}
}