Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

how can i make animation when object hit trigger ?

Discussion in 'Animation' started by karammaks, Apr 29, 2014.

  1. karammaks

    karammaks

    Joined:
    Apr 6, 2014
    Posts:
    146
    I want a help in animation (i already made topic there but didnt get enough help), i have a game which objects fall and player should catch them by box trigger, so when spawner fell a Bomb in Box trigger , i want to make a BOOM animation , but i dont know where to put the script and what will the script going to be and how ? i already made a trigger for the box , and when the bomb hit that trigger it gives -5 to the score , and it works fine, but i still want to add animation so when the bomb hit that trigger it make BooM animation , and i also have animation for the bomb fuze which is flash , so i dont know if i have to add Boom Animation for the same bomb or the animation should be alone , this is my code for the Box trigger :

    Code (csharp):
    1.     public class DestroyObjectAndAddPoint : MonoBehaviour {
    2.        
    3.             int Score=0;
    4.         int score_Bomb=0;
    5.     public TextMesh scoreText;
    6.     void OnTriggerEnter2D(Collider2D collisionObject){
    7.                
    8.            
    9.      
    10.                             Destroy (collisionObject.gameObject);
    11.      
    12.                            
    13.                                            
    14.                             Bomb scoreBomb = collisionObject.GetComponent<Bomb> ();
    15.     if (scoreBomb != null) {
    16.                             score_Bomb = score_Bomb + scoreBomb.scoreBomb1;
    17.                     }
    18.     Score =score_Bomb;
    19.     scoreText.text= "Score: " + Score;
    20.     }
    21.         }
    and this for the Bomb :

    Code (csharp):
    1.     public class Bomb : MonoBehaviour {
    2.      
    3.         public int scoreBomb1 = -5;
    4.      
    5.      
    6.      
    7.     }
    wish you help me very soon :(
     
  2. karammaks

    karammaks

    Joined:
    Apr 6, 2014
    Posts:
    146
    ^^^ please any one can help ???
     
  3. karammaks

    karammaks

    Joined:
    Apr 6, 2014
    Posts:
    146