// Update is called once per frame void Update() { RaycastHit hit; Vector3 forward = transform.TransformDirection(Vector3.forward); if (Physics.Raycast(transform.position, forward, out hit, maxDistance) && !onInspect) { collectable = hit.collider.gameObject.CompareTag(collectableTag); if (collectable) { goCollectable = hit.collider.gameObject; } if (hit.collider.gameObject.CompareTag(selectableTag) || collectable) { hittedObject = hit.collider.gameObject; material = hittedObject.GetComponent <Renderer>().material; material.SetFloat("_OutlineThickness", 0.03f); material.SetColor("_OutlineColor", outlineColor); if (Input.GetKeyDown(KeyCode.Mouse0)) { inspected = hit.collider.gameObject; inspected.GetComponent <Collider>().isTrigger = true; originalPosition = hit.transform.position; originalRotation = hit.transform.rotation; onInspect = true; depthOfField.active = true; StartCoroutine(pickupItem()); } } } else { if (hittedObject != null) { material.SetFloat("_OutlineThickness", 0.0f); hittedObject = null; } } if (onInspect) { inspected.transform.position = Vector3.Lerp(inspected.transform.position, playerSocket.position, 0.2f); Vector3 rotation = new Vector3(Input.GetAxis("Mouse Y"), -Input.GetAxis("Mouse X"), 0) * Time.deltaTime * 125f; playerSocket.Rotate(rotation); } if (Input.GetKeyDown(KeyCode.Mouse1) && onInspect) { if (collectable) { Main_sc.SetInventoryItem(goCollectable.name, true); goCollectable.SetActive(false); } StartCoroutine(dropItem()); onInspect = false; } }
void Interact() { isUnlocked = Main_sc.GetInventoryItem(requiredObject); if (isUnlocked) { if (isPuzzle) { GetComponent <Puzzle_sc>().Activate(); } else { GetComponent <Open_object_sc>().Open(); } } }
public override void OnResolve() { Main_sc.SetKey("code1", string.Join(string.Empty, code)); }