Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Sensor : MonoBehaviour {
- public static GameObject captureTarget;
- public static GameObject containTarget {
- get {
- return captureTarget;
- }
- set {
- captureTarget = value;
- }
- }
- void OnTriggerEnter2D(Collider2D other) {
- containTarget = other.gameObject;
- //Debug.Log(containTarget.tag);
- }
- void OnTriggerExit2D(Collider2D other) {
- if(containTarget != null){
- containTarget = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement