Advertisement
Guest User

BlockBreaker

a guest
Sep 4th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. public GameObject smoke;    
  2. private Color explosionColor;
  3. private Sprite_Handler spriteHandler;
  4.    
  5.     void Start () {
  6.         spriteHandler = FindObjectOfType<Sprite_Handler>();
  7.     }
  8.    
  9.     void OnCollisionEnter2D(Collision2D collision){
  10.         ShowSprite();
  11.         Smoke();
  12.     }
  13.  
  14.     void ShowSprite(){        
  15.         Color newColor = spriteHandler.GetColor();
  16.         explosionColor = newColor;
  17.     }
  18.    
  19.     void Smoke(){
  20.         GameObject explosion =  Instantiate(smoke, this.transform.position, Quaternion.identity) as  GameObject;
  21.         explosion.GetComponent<ParticleSystem>().startColor = explosionColor;
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement