Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GenericTrigger2D : MonoBehaviour
  6. {
  7.     // Add here any tags you want the trigger to ignore. Leave empty to allow all
  8.     public List<string> ignoreTags = new List<string> { };
  9.     private Collider2D collider;
  10.  
  11.     void Start(){
  12.         collider = GetComponent<Collider2D>();
  13.     }
  14.     void OnTriggerEnter2D(Collider2D coll)
  15.     {
  16.         if (!ignoreTags.Contains(coll.gameObject.tag))
  17.         {
  18.             Debug.Log("Raising event");
  19.             Fungus.FungusManager.Instance.EventDispatcher.Raise(new Custom_EventHandler_Trigger2D.Custom_EventHandlerEvent() { hitObject = coll, source = collider });
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement