Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class StationDroneAggro : MonoBehaviour
- {
- public GameObject droneTrgt;
- public string droneTarget;
- void OnTriggerEnter2D(Collider2D col)
- {
- if (droneTrgt == null && col.CompareTag(droneTarget))
- {
- droneTrgt = col.gameObject;
- }
- }
- void OnTriggerStay2D(Collider2D col)
- {
- if (droneTrgt == null && col.CompareTag(droneTarget))
- {
- droneTrgt = col.gameObject;
- }
- }
- void OnTriggerExit2D(Collider2D col)
- {
- if (droneTrgt != null)
- {
- Debug.Log("target is null");
- droneTrgt = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement