Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class gridTrigger : MonoBehaviour {
- Collider collider;
- bool isColliding = false;
- // Use this for initialization
- void Start () {
- collider = null;
- }
- void OnTriggerEnter(Collider other) {
- collider = other;
- isColliding = true;
- }
- void OnTriggerExit(Collider other) {
- isColliding = false;
- }
- // Update is called once per frame
- void Update () {
- }
- // Check is grid cube free to use / does it overlap with specific object
- public bool isTriggered (GameObject isInTrigger){
- bool localBool = false;
- if(collider != null){
- Debug.Log ("toimii");
- if(isInTrigger != null){
- if(collider == isInTrigger.collider){
- localBool = true;
- }
- }
- if(isInTrigger == null){
- localBool = true;
- }
- if (collider == null){
- localBool = false;
- }
- }
- return localBool;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment