mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-10-11 18:19:11 +00:00
Textboxes now instantiate on triggers, ish
This commit is contained in:
1 parent
71ea85379f
commit
3a81f1a122
6 files changed
+310
-80
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user