Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System;
- public class Detector : MonoBehaviour
- {
- private bool detectado;
- public Action<bool> onReady;
- private void OnTriggerEnter2D(Collider2D other)
- {
- if(other.CompareTag("Floor"))
- {
- detectado = true;
- IsReady();
- }
- }
- private void OnTriggerExit2D(Collider2D other)
- {
- if (other.CompareTag("Floor"))
- {
- detectado = false;
- IsReady();
- }
- }
- public void IsReady()
- {
- onReady(detectado);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement