Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class MyCollisionDetector : MonoBehaviour
- {
- public GameObject panel;
- public Transform playerObject;
- public float distance = 2;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- //Debug.LogError("Hello");
- }
- void OnMouseDown()
- {
- var dist = Math.Abs(Vector3.Distance(this.transform.position, playerObject.position));
- Debug.Log("Distance is " + dist);
- if (dist < distance){
- Destroy(gameObject);
- panel.SetActive(true);
- var conteggio = GameObject.Find("Player").GetComponent<Conteggio>();
- conteggio.checkObjects();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement