Textboxes now instantiate on triggers, ish

This commit is contained in:
Rizvee committed 2022-02-23 17:40:38 -06:00
1 parent 71ea85379f
commit 3a81f1a122
6 files changed
+310 -80

No files matched your search

+19 -1
View File
@@ -4,16 +4,34 @@ using UnityEngine;
public class Interaction : MonoBehaviour
{
public Transform detectionPoint;
public float radius = 3f;
public LayerMask detectLayer;
// Start is called before the first frame update
void Start()
{
}
bool InteractInput() {
if(Input.GetKeyDown(KeyCode.E))
Debug.Log("input");
return true;
}
// Update is called once per frame
void Update()
{
if(DetectObject()) {
if(InteractInput()) {
Debug.Log("interacted");
}
}
}
bool DetectObject() {
if(Physics2D.OverlapCircle(detectionPoint.position, radius, detectLayer))
Debug.Log("detected");
return false;
}
}