public override void PrimaryDown() { Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); if (Physics.Raycast(ray, out RaycastHit hit, 10, InteractController.LayerMask)) { if (hit.transform.IsChildOf(boxLock.transform) && hit.distance <= boxLock.activationRange && electricBox.isLocked()) { electricBox.Unlock(); InteractController.Instance().DeleteItem(); } } }
public override void PrimaryDown() { Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); if (Physics.Raycast(ray, out RaycastHit hit, 10, InteractController.LayerMask)) { if (hit.transform.IsChildOf(allenKeySlot.transform) && hit.distance <= allenKeySlot.activationRange && !waterControlCabinet.isOn()) { waterControlCabinet.TurnOn(); InteractController.Instance().DeleteItem(); } } }
public override void PrimaryDown() { Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); if (Physics.Raycast(ray, out RaycastHit hit, 10, InteractController.LayerMask)) { Ladder ladder = hit.transform.GetComponentInParent <Ladder>(); if (ladder && hit.distance <= ladder.activationRange) { ladder.AddRungs(); InteractController.Instance().DeleteItem(); } } }