Assemblied created

This commit is contained in:
2023-06-02 00:30:58 -04:00
parent 3e1b55b036
commit 63039dbde2
99 changed files with 8302 additions and 1065 deletions

View File

@ -1,5 +1,5 @@
using UnityEngine;
namespace Item {
public class Insertable : MonoBehaviour
{
// Start is called before the first frame update
@ -11,4 +11,5 @@ public class Insertable : MonoBehaviour
private void Update()
{
}
}
}

View File

@ -1,4 +1,7 @@
using UnityEngine;
namespace Item
{
public class Interactable : MonoBehaviour
{
@ -11,4 +14,5 @@ public class Interactable : MonoBehaviour
private void Update()
{
}
}
}

View File

@ -1,44 +1,46 @@
using UnityEngine;
public class ItemSelector : MonoBehaviour
namespace Item
{
public static ItemSelector instance;
[SerializeField] private Camera cam;
[SerializeField] private LayerMask mask;
[SerializeField] private float range = 1;
public InteractableItem Selected { get; private set; }
// Start is called before the first frame update
private void Start()
public class ItemSelector : MonoBehaviour
{
instance = this;
}
public static ItemSelector instance;
// Update is called once per frame
private void Update()
{
}
[SerializeField] private Camera cam;
private void FixedUpdate()
{
var ray = cam.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
[SerializeField] private LayerMask mask;
if (Physics.Raycast(ray, out hit, range, mask))
[SerializeField] private float range = 1;
public InteractableItem Selected { get; private set; }
// Start is called before the first frame update
private void Start()
{
if (Selected != null || hit.transform.gameObject == null) Selected.Disable();
Selected = hit.transform.gameObject.GetComponent<InteractableItem>();
Selected.Enable();
print(Selected);
instance = this;
}
else
// Update is called once per frame
private void Update()
{
if (Selected != null) Selected.Disable();
}
private void FixedUpdate()
{
var ray = cam.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, range, mask))
{
if (Selected != null || hit.transform.gameObject == null) Selected.Disable();
Selected = hit.transform.gameObject.GetComponent<InteractableItem>();
Selected.Enable();
print(Selected);
}
else
{
if (Selected != null) Selected.Disable();
}
}
}
}