Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class SwitchCharacter : MonoBehaviour
  6. {
  7. public GameObject currentCharacter;
  8. public GameObject nextCharacter;
  9.  
  10. bool collision_activated;
  11.  
  12. void OnCollisionEnter2D(Collision2D collision)
  13. {
  14. if (collision.gameObject.tag == nextCharacter.tag)
  15. {
  16. collision_activated = true;
  17. Destroy(currentCharacter);
  18.  
  19. nextCharacter.AddComponent(currentCharacter.GetComponents);
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement