public void SetTarget(Vector3 target, CharController.OnScriptedTargetReached cb) { Vector3 targetLocalPos = m_cameraInitialPosLocalSpace; Vector3 localPos = m_mainCamera.transform.parent.InverseTransformPoint(target); targetLocalPos.x = localPos.x; TweenToLocalPos(targetLocalPos); m_onScriptedTargetReachedCb = cb; }
private void MovePlayerIntoPosition() { if (m_playerCharController) { CharController.OnScriptedTargetReached onTargetReached = (() => { OpenMenuPage(); }); m_playerCharController.ScriptedMoveToPos(m_interactionTarget.transform, m_interactionMenuPage.transform, onTargetReached); m_playerCharController.SetLookUpTarget(m_interactionMenuPage); } }
private void UpdateScriptedCameraTarget() { if (m_isInScriptedMove) { float distanceCovered = m_scriptedCameraMoveSpeed * (Time.time - m_moveStartTime); float factor = distanceCovered / m_moveDistance; m_mainCamera.transform.localPosition = Vector3.Lerp(m_startLocalSpace, m_targetLocalSpace, factor); float distance = Vector3.Distance(m_mainCamera.transform.localPosition, m_targetLocalSpace); if (distance <= Vector3.kEpsilon) { m_isInScriptedMove = false; if (m_onScriptedTargetReachedCb != null) { m_onScriptedTargetReachedCb.Invoke(); m_onScriptedTargetReachedCb = null; } } } }