Steam lobby implemented
This commit is contained in:
@ -1,18 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Insertable : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,20 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Interactable : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,57 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ItemSelector : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Camera cam;
|
||||
private InteractableItem selected;
|
||||
|
||||
[SerializeField]
|
||||
private LayerMask mask;
|
||||
public static ItemSelector instance;
|
||||
[SerializeField]
|
||||
private float range = 1;
|
||||
|
||||
public InteractableItem Selected { get { return selected; } }
|
||||
[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
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
void FixedUpdate()
|
||||
// Update is called once per frame
|
||||
private void Update()
|
||||
{
|
||||
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
var ray = cam.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
|
||||
if (Physics.Raycast(ray, out hit,range,layerMask:mask))
|
||||
if (Physics.Raycast(ray, out hit, range, mask))
|
||||
{
|
||||
if(selected!= null||hit.transform.gameObject==null)
|
||||
{
|
||||
selected.Disable();
|
||||
}
|
||||
if (Selected != null || hit.transform.gameObject == null) Selected.Disable();
|
||||
|
||||
selected = hit.transform.gameObject.GetComponent<InteractableItem>();
|
||||
selected.Enable();
|
||||
print(selected);
|
||||
Selected = hit.transform.gameObject.GetComponent<InteractableItem>();
|
||||
Selected.Enable();
|
||||
print(Selected);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selected != null)
|
||||
{
|
||||
selected.Disable();
|
||||
}
|
||||
|
||||
if (Selected != null) Selected.Disable();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user