Class InteractaCore<T>
A simple interaction framework for selecting screen-center objects.
public abstract class InteractaCore<T> : MonoBehaviour
Type Parameters
T
- Inheritance
-
objectObjectComponentBehaviourMonoBehaviourInteractaCore<T>
- Derived
Fields
InteractMask
[Tooltip("Layer of the interactable objects")]
public LayerMask InteractMask
Field Value
- LayerMask
discoveryRadius
[Tooltip("Size of sphereCast. Determines the radius from screen center in which objects will be picked up.")]
public float discoveryRadius
Field Value
- float
interactRange
[Header("Settings")]
[Tooltip("How far car we interact with objects")]
public float interactRange
Field Value
- float
mainCam
[Header("References")]
public Camera mainCam
Field Value
- Camera
objects
[Space(10)]
[Header("Debug")]
public List<GameObject> objects
Field Value
- List<GameObject>
occluders
public List<GameObject> occluders
Field Value
- List<GameObject>
occlusionMask
[Tooltip("Layer which will be checked against interactables for occlusion.")]
public LayerMask occlusionMask
Field Value
- LayerMask
player
public T player
Field Value
- T
selectedObject
Object currently selected by Interacta. Access this field from UI or other scripts to get the selected object.
[HideInInspector]
public GameObject selectedObject
Field Value
- GameObject
Methods
DoInteract()
This method invokes interact event on the currently selected item
public virtual void DoInteract()
FixedUpdate()
Update loop to find the Interactable item we are looking at.
protected virtual void FixedUpdate()
Start()
Get References
protected virtual void Start()