/** * Arrive in the node: * - Interact with the prop if it's enabled; * - Make this object interactable if prerequisite is met. */ public override void Arrive() { if (inter != null && inter.enabled) { inter.Interact(); return; } PathReactor path = GetComponent <PathReactor>(); if (path == null || path.switcher.state) { base.Arrive(); } // Make this object interactable if prerequisite is met if (inter != null) { Prerequisite pre = GetComponent <Prerequisite>(); if (pre && !inter.inspectObject && !pre.Complete) { return; } col.enabled = true; inter.enabled = true; changeMouseIcon(); } }
void Interact() { RaycastHit hit; if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, 10)) { Interactables interactable = hit.collider.GetComponent <Interactables>(); if (interactable != null) { interactable.Interact(); } } }
public override void Arrive() { if (inter != null && inter.enabled) { inter.Interact(); return; } base.Arrive(); // make this object interactable if prerequisite os met if (inter != null) { Prerequisite pre = GetComponent <Prerequisite>(); if (pre && !pre.Complete) { return; } col.enabled = true; inter.enabled = true; } }