public override void Observe() { Debug.Log("saw ground"); //advance objective tut.checkedWorld(); // pass through base.Observe(); }
private void handleInteract() { bool intPressed = Input.GetButtonDown("Interact"); bool dropPressed = Input.GetButtonDown("Drop"); bool obsPressed = Input.GetButtonDown("Observe"); if (intPressed) { //always try to lock cursor Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } //drop first idk if (dropPressed) { inv.dropCurrent(); } //raycast to object? RaycastHit hitInfoInteract, hitInfoObserve; bool didHitInteract = Physics.Raycast(cam.transform.position, cam.transform.forward, out hitInfoInteract, INTERACTION_DIST, INTERACTABLE_MASK); bool didHitObserve = Physics.Raycast(cam.transform.position, cam.transform.forward, out hitInfoObserve, OBSERVATION_DIST, OBSERVABLE_MASK); //Debug.DrawRay(cam.transform.position, cam.transform.forward); if (didHitObserve) { Observation obs = hitInfoObserve.collider.GetComponent <Observation>(); if (obs != null) { cursor.sprite = cursorSee; if (obsPressed) { Debug.Log("observing..."); obs.Observe(); if (tut != null) { tut.checkedWorld(); } } } else { didHitObserve = false; } } if (didHitInteract) { Interaction i = hitInfoInteract.collider.GetComponent <Interaction>(); if (i != null) { cursor.sprite = cursorGrab; if (intPressed) { if (i.pickUp) { inv.addObject(hitInfoInteract.collider.transform.parent.gameObject); //interactions always children of objects. } else { i.doAction(); } } } else { didHitInteract = false; } } if (!didHitObserve && !didHitInteract) { cursor.sprite = cursorNone; } //switch objects float scroll = Input.GetAxis("Scroll"); bool nextButton = Input.GetButtonDown("Next"); bool prevButton = Input.GetButtonDown("Prev"); if (scroll > 0.01f || nextButton) { inv.selectNext(); if (tut != null) { tut.checkedNote(); } } else if (scroll < -0.01f || prevButton) { inv.selectPrev(); if (tut != null) { tut.checkedNote(); } } }