Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public GameObject smoke;
- private Color explosionColor;
- private Sprite_Handler spriteHandler;
- void Start () {
- spriteHandler = FindObjectOfType<Sprite_Handler>();
- }
- void OnCollisionEnter2D(Collision2D collision){
- ShowSprite();
- Smoke();
- }
- void ShowSprite(){
- Color newColor = spriteHandler.GetColor();
- explosionColor = newColor;
- }
- void Smoke(){
- GameObject explosion = Instantiate(smoke, this.transform.position, Quaternion.identity) as GameObject;
- explosion.GetComponent<ParticleSystem>().startColor = explosionColor;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement