void SwitchToFishing(InputAction.CallbackContext context) { if (m_currFishingSign == null) { return; } m_currFishingSign.SetInteractable(false); m_playerControls.Player.Disable(); m_playerInput.SwitchCurrentActionMap("Fishing"); m_playerControls.Fishing.Enable(); m_playerMovement.StopMovement(); m_playerMovement.SetPosition(m_currFishingSign.PlayerAnchor); m_fishingReticle.SetActive(true); m_fishingRod.SetActive(true); m_fishingRod.FishingAreaTransform = m_currFishingSign.FishingArea.transform; var fishingCam = m_currFishingSign.FishingCamera; Ray ray = new Ray(fishingCam.position, fishingCam.forward); if (Physics.Raycast(ray, out RaycastHit hitinfo, m_waterMaxDist, m_waterLayerMask)) { m_fishingReticle.SetPosition(hitinfo.point + Vector3.up * 0.1f); } m_fishingCamera.LookAt = m_fishingReticle.transform; m_uiManager.ToggleInstructions("Aiming"); ChangeState(FishingState.Aiming); }
private void OnTriggerExit(Collider other) { if (m_currFishingSkillLevel == 0) { return; } if (m_fishingSignLayerMask == (m_fishingSignLayerMask | (1 << other.gameObject.layer))) { FishingSign sign = other.GetComponent <FishingSign>(); if (sign == null) { Debug.LogError("Exited trigger of chracter who is not fish sign."); return; } if (m_currFishingSign != sign) { Debug.LogWarning("Exiting fish sign range that you weren't in range of."); sign.SetInteractable(false); } if (m_currFishingSign == null) { return; } m_currFishingSign.SetInteractable(false); m_fishingCamera = null; m_currFishingSign = null; } }
private void OnTriggerEnter(Collider other) { if (m_currFishingSkillLevel == 0) { return; } if (m_fishingSignLayerMask == (m_fishingSignLayerMask | (1 << other.gameObject.layer))) { FishingSign sign = other.GetComponent <FishingSign>(); if (sign == null) { Debug.LogError("Entered trigger of chracter who is not fishing sign."); return; } if (m_currFishingSign != null) { Debug.LogWarning("Overriding current fishing sign to talk to."); m_currFishingSign.SetInteractable(false); } // Check NodeExists if (!sign.Interactible) { m_fishingCamera = null; m_currFishingSign = null; return; } m_currFishingSign = sign; m_fishingCamera = m_currFishingSign.FishingCamera.GetComponent <CinemachineVirtualCamera>(); m_currFishingSign.SetInteractable(true); } }